chef 12.5.0.alpha.1 → 12.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (275) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +21 -25
  3. data/Gemfile +46 -0
  4. data/README.md +4 -4
  5. data/Rakefile +5 -110
  6. data/distro/common/html/knife_cookbook_site.html +18 -18
  7. data/distro/common/man/man1/knife-cookbook-site.1 +11 -11
  8. data/lib/chef/application.rb +1 -1
  9. data/lib/chef/application/apply.rb +19 -1
  10. data/lib/chef/application/client.rb +11 -5
  11. data/lib/chef/application/knife.rb +2 -2
  12. data/lib/chef/application/windows_service_manager.rb +9 -7
  13. data/lib/chef/chef_class.rb +39 -0
  14. data/lib/chef/chef_fs/data_handler/client_data_handler.rb +3 -1
  15. data/lib/chef/chef_fs/file_system/acl_dir.rb +3 -4
  16. data/lib/chef/chef_fs/file_system/acls_dir.rb +5 -1
  17. data/lib/chef/chef_fs/file_system/base_fs_dir.rb +0 -5
  18. data/lib/chef/chef_fs/file_system/base_fs_object.rb +5 -2
  19. data/lib/chef/chef_fs/file_system/chef_repository_file_system_cookbook_dir.rb +2 -9
  20. data/lib/chef/chef_fs/file_system/chef_repository_file_system_cookbook_entry.rb +2 -9
  21. data/lib/chef/chef_fs/file_system/chef_repository_file_system_cookbooks_dir.rb +10 -17
  22. data/lib/chef/chef_fs/file_system/chef_repository_file_system_entry.rb +1 -12
  23. data/lib/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb +15 -11
  24. data/lib/chef/chef_fs/file_system/chef_server_root_dir.rb +8 -2
  25. data/lib/chef/chef_fs/file_system/cookbook_dir.rb +3 -4
  26. data/lib/chef/chef_fs/file_system/cookbooks_acl_dir.rb +1 -1
  27. data/lib/chef/chef_fs/file_system/cookbooks_dir.rb +3 -11
  28. data/lib/chef/chef_fs/file_system/data_bags_dir.rb +3 -5
  29. data/lib/chef/chef_fs/file_system/environments_dir.rb +1 -1
  30. data/lib/chef/chef_fs/file_system/file_system_entry.rb +7 -4
  31. data/lib/chef/chef_fs/file_system/memory_dir.rb +2 -3
  32. data/lib/chef/chef_fs/file_system/multiplexed_dir.rb +15 -0
  33. data/lib/chef/chef_fs/file_system/nodes_dir.rb +1 -1
  34. data/lib/chef/chef_fs/file_system/organization_members_entry.rb +2 -2
  35. data/lib/chef/chef_fs/file_system/rest_list_dir.rb +4 -9
  36. data/lib/chef/client.rb +2 -3
  37. data/lib/chef/config.rb +34 -2
  38. data/lib/chef/cookbook/metadata.rb +25 -3
  39. data/lib/chef/cookbook/synchronizer.rb +1 -1
  40. data/lib/chef/cookbook_site_streaming_uploader.rb +1 -1
  41. data/lib/chef/cookbook_version.rb +3 -3
  42. data/lib/chef/deprecation/mixin/template.rb +1 -2
  43. data/lib/chef/deprecation/provider/cookbook_file.rb +1 -1
  44. data/lib/chef/deprecation/provider/file.rb +1 -1
  45. data/lib/chef/deprecation/provider/remote_directory.rb +52 -0
  46. data/lib/chef/deprecation/provider/remote_file.rb +1 -2
  47. data/lib/chef/deprecation/provider/template.rb +1 -1
  48. data/lib/chef/deprecation/warnings.rb +3 -4
  49. data/lib/chef/dsl/reboot_pending.rb +3 -2
  50. data/lib/chef/dsl/recipe.rb +6 -5
  51. data/lib/chef/dsl/resources.rb +2 -2
  52. data/lib/chef/event_dispatch/base.rb +12 -7
  53. data/lib/chef/event_dispatch/dispatcher.rb +21 -6
  54. data/lib/chef/exceptions.rb +22 -0
  55. data/lib/chef/file_content_management/tempfile.rb +1 -1
  56. data/lib/chef/formatters/base.rb +3 -0
  57. data/lib/chef/formatters/doc.rb +53 -5
  58. data/lib/chef/formatters/error_inspectors/compile_error_inspector.rb +36 -0
  59. data/lib/chef/formatters/minimal.rb +2 -2
  60. data/lib/chef/knife.rb +35 -55
  61. data/lib/chef/knife/bootstrap.rb +41 -0
  62. data/lib/chef/knife/bootstrap/chef_vault_handler.rb +1 -0
  63. data/lib/chef/knife/bootstrap/client_builder.rb +16 -0
  64. data/lib/chef/knife/bootstrap/templates/README.md +3 -4
  65. data/lib/chef/knife/cookbook_create.rb +1 -1
  66. data/lib/chef/knife/cookbook_site_download.rb +1 -1
  67. data/lib/chef/knife/cookbook_site_install.rb +1 -1
  68. data/lib/chef/knife/cookbook_site_share.rb +6 -6
  69. data/lib/chef/knife/cookbook_site_unshare.rb +2 -2
  70. data/lib/chef/knife/core/bootstrap_context.rb +12 -4
  71. data/lib/chef/knife/core/custom_manifest_loader.rb +69 -0
  72. data/lib/chef/knife/core/gem_glob_loader.rb +138 -0
  73. data/lib/chef/knife/core/hashed_command_loader.rb +80 -0
  74. data/lib/chef/knife/core/node_presenter.rb +24 -1
  75. data/lib/chef/knife/core/object_loader.rb +1 -0
  76. data/lib/chef/knife/core/subcommand_loader.rb +131 -146
  77. data/lib/chef/knife/node_run_list_remove.rb +12 -1
  78. data/lib/chef/knife/null.rb +10 -0
  79. data/lib/chef/knife/rehash.rb +62 -0
  80. data/lib/chef/knife/search.rb +3 -3
  81. data/lib/chef/knife/ssh.rb +52 -30
  82. data/lib/chef/local_mode.rb +5 -0
  83. data/lib/chef/log.rb +5 -1
  84. data/lib/chef/mixin/deprecation.rb +8 -8
  85. data/lib/chef/mixin/params_validate.rb +2 -2
  86. data/lib/chef/mixin/template.rb +48 -0
  87. data/lib/chef/mixin/which.rb +1 -1
  88. data/lib/chef/mixin/wide_string.rb +72 -0
  89. data/lib/chef/mixin/windows_architecture_helper.rb +15 -39
  90. data/lib/chef/mixin/windows_env_helper.rb +4 -1
  91. data/lib/chef/monkey_patches/webrick-utils.rb +51 -0
  92. data/lib/chef/monkey_patches/win32/registry.rb +72 -0
  93. data/lib/chef/node.rb +97 -3
  94. data/lib/chef/node_map.rb +2 -2
  95. data/lib/chef/platform/provider_mapping.rb +5 -6
  96. data/lib/chef/platform/query_helpers.rb +46 -4
  97. data/lib/chef/platform/service_helpers.rb +30 -32
  98. data/lib/chef/policy_builder.rb +1 -8
  99. data/lib/chef/policy_builder/dynamic.rb +186 -0
  100. data/lib/chef/policy_builder/expand_node_object.rb +30 -15
  101. data/lib/chef/policy_builder/policyfile.rb +155 -18
  102. data/lib/chef/property.rb +38 -9
  103. data/lib/chef/provider.rb +104 -12
  104. data/lib/chef/provider/batch.rb +8 -0
  105. data/lib/chef/provider/deploy.rb +2 -2
  106. data/lib/chef/provider/directory.rb +14 -2
  107. data/lib/chef/provider/dsc_resource.rb +5 -9
  108. data/lib/chef/provider/group/pw.rb +1 -1
  109. data/lib/chef/provider/ifconfig.rb +2 -2
  110. data/lib/chef/provider/mount.rb +7 -3
  111. data/lib/chef/provider/package/dpkg.rb +5 -11
  112. data/lib/chef/provider/package/rpm.rb +2 -2
  113. data/lib/chef/provider/package/rubygems.rb +1 -1
  114. data/lib/chef/provider/package/windows/msi.rb +2 -2
  115. data/lib/chef/provider/package/yum.rb +17 -5
  116. data/lib/chef/provider/powershell_script.rb +27 -4
  117. data/lib/chef/provider/remote_directory.rb +190 -102
  118. data/lib/chef/provider/service.rb +12 -2
  119. data/lib/chef/provider/service/aix.rb +1 -1
  120. data/lib/chef/provider/service/debian.rb +3 -5
  121. data/lib/chef/provider/service/freebsd.rb +1 -1
  122. data/lib/chef/provider/service/gentoo.rb +3 -3
  123. data/lib/chef/provider/service/init.rb +3 -3
  124. data/lib/chef/provider/service/insserv.rb +2 -4
  125. data/lib/chef/provider/service/invokercd.rb +2 -4
  126. data/lib/chef/provider/service/openbsd.rb +2 -1
  127. data/lib/chef/provider/service/redhat.rb +52 -16
  128. data/lib/chef/provider/service/simple.rb +2 -2
  129. data/lib/chef/provider/service/systemd.rb +3 -5
  130. data/lib/chef/provider/service/upstart.rb +4 -6
  131. data/lib/chef/provider/subversion.rb +13 -7
  132. data/lib/chef/provider/template/content.rb +16 -6
  133. data/lib/chef/provider/user/solaris.rb +32 -4
  134. data/lib/chef/provider/windows_script.rb +3 -5
  135. data/lib/chef/provider_resolver.rb +2 -2
  136. data/lib/chef/resource.rb +85 -27
  137. data/lib/chef/resource/action_class.rb +83 -0
  138. data/lib/chef/resource/chef_gem.rb +3 -3
  139. data/lib/chef/resource/deploy.rb +8 -2
  140. data/lib/chef/resource/dsc_script.rb +2 -0
  141. data/lib/chef/resource/file/verification.rb +1 -1
  142. data/lib/chef/resource/registry_key.rb +1 -1
  143. data/lib/chef/resource/service.rb +10 -2
  144. data/lib/chef/resource/subversion.rb +5 -0
  145. data/lib/chef/resource/windows_script.rb +6 -2
  146. data/lib/chef/resource/yum_package.rb +10 -1
  147. data/lib/chef/resource_resolver.rb +3 -3
  148. data/lib/chef/run_context.rb +6 -8
  149. data/lib/chef/run_list/versioned_recipe_list.rb +15 -0
  150. data/lib/chef/run_lock.rb +30 -21
  151. data/lib/chef/util/powershell/ps_credential.rb +4 -0
  152. data/lib/chef/util/windows.rb +0 -32
  153. data/lib/chef/util/windows/net_group.rb +85 -106
  154. data/lib/chef/util/windows/net_use.rb +35 -71
  155. data/lib/chef/util/windows/net_user.rb +0 -1
  156. data/lib/chef/util/windows/volume.rb +19 -19
  157. data/lib/chef/version.rb +3 -3
  158. data/lib/chef/win32/api.rb +1 -0
  159. data/lib/chef/win32/api/file.rb +20 -0
  160. data/lib/chef/win32/api/net.rb +163 -43
  161. data/lib/chef/win32/api/registry.rb +51 -0
  162. data/lib/chef/win32/api/system.rb +23 -0
  163. data/lib/chef/win32/api/unicode.rb +0 -43
  164. data/lib/chef/win32/crypto.rb +2 -1
  165. data/lib/chef/win32/file.rb +28 -3
  166. data/lib/chef/win32/mutex.rb +1 -2
  167. data/lib/chef/win32/net.rb +162 -8
  168. data/lib/chef/win32/process.rb +13 -0
  169. data/lib/chef/win32/registry.rb +25 -28
  170. data/lib/chef/win32/security.rb +1 -1
  171. data/lib/chef/win32/security/token.rb +1 -1
  172. data/lib/chef/win32/system.rb +62 -0
  173. data/lib/chef/win32/unicode.rb +7 -2
  174. data/lib/chef/win32/version.rb +0 -4
  175. data/spec/data/cookbooks/openldap/templates/default/helpers.erb +14 -0
  176. data/spec/data/cookbooks/openldap/templates/default/nested_openldap_partials.erb +1 -0
  177. data/spec/data/cookbooks/openldap/templates/default/nested_partial.erb +1 -0
  178. data/spec/data/dsc_lcm.pfx +0 -0
  179. data/spec/functional/dsl/reboot_pending_spec.rb +33 -43
  180. data/spec/functional/knife/cookbook_delete_spec.rb +17 -7
  181. data/spec/functional/knife/ssh_spec.rb +16 -0
  182. data/spec/functional/resource/deploy_revision_spec.rb +1 -1
  183. data/spec/functional/resource/dsc_resource_spec.rb +2 -0
  184. data/spec/functional/resource/dsc_script_spec.rb +91 -2
  185. data/spec/functional/resource/group_spec.rb +67 -44
  186. data/spec/functional/resource/powershell_script_spec.rb +104 -15
  187. data/spec/functional/resource/windows_service_spec.rb +1 -1
  188. data/spec/functional/run_lock_spec.rb +368 -189
  189. data/spec/functional/win32/{registry_helper_spec.rb → registry_spec.rb} +4 -23
  190. data/spec/integration/client/client_spec.rb +51 -0
  191. data/spec/integration/knife/download_spec.rb +4 -0
  192. data/spec/integration/knife/list_spec.rb +8 -0
  193. data/spec/integration/knife/upload_spec.rb +1 -1
  194. data/spec/integration/recipes/recipe_dsl_spec.rb +1 -1
  195. data/spec/integration/recipes/remote_directory.rb +74 -0
  196. data/spec/integration/recipes/resource_action_spec.rb +42 -22
  197. data/spec/integration/recipes/resource_converge_if_changed_spec.rb +423 -0
  198. data/spec/integration/recipes/resource_load_spec.rb +206 -0
  199. data/spec/spec_helper.rb +8 -0
  200. data/spec/support/platform_helpers.rb +13 -0
  201. data/{lib/chef/mixin/wstring.rb → spec/support/shared/context/win32.rb} +15 -12
  202. data/spec/support/shared/functional/windows_script.rb +63 -26
  203. data/spec/support/shared/unit/mock_shellout.rb +46 -0
  204. data/spec/support/shared/unit/provider/file.rb +10 -4
  205. data/spec/unit/application/client_spec.rb +16 -3
  206. data/spec/unit/application/knife_spec.rb +2 -2
  207. data/spec/unit/chef_class_spec.rb +0 -4
  208. data/spec/unit/client_spec.rb +6 -1
  209. data/spec/unit/config_spec.rb +31 -0
  210. data/spec/unit/cookbook/metadata_spec.rb +23 -3
  211. data/spec/unit/cookbook/syntax_check_spec.rb +3 -0
  212. data/spec/unit/deprecation_spec.rb +3 -6
  213. data/spec/unit/dsl/reboot_pending_spec.rb +12 -6
  214. data/spec/unit/event_dispatch/dispatcher_spec.rb +65 -3
  215. data/spec/unit/event_dispatch/dsl_spec.rb +0 -4
  216. data/spec/unit/formatters/doc_spec.rb +32 -0
  217. data/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb +26 -0
  218. data/spec/unit/knife/bootstrap/client_builder_spec.rb +27 -0
  219. data/spec/unit/knife/bootstrap_spec.rb +55 -3
  220. data/spec/unit/knife/cookbook_site_share_spec.rb +3 -3
  221. data/spec/unit/knife/core/bootstrap_context_spec.rb +21 -4
  222. data/spec/unit/knife/core/custom_manifest_loader_spec.rb +41 -0
  223. data/spec/unit/knife/core/gem_glob_loader_spec.rb +210 -0
  224. data/spec/unit/knife/core/hashed_command_loader_spec.rb +93 -0
  225. data/spec/unit/knife/core/subcommand_loader_spec.rb +16 -192
  226. data/spec/unit/knife/node_run_list_remove_spec.rb +17 -0
  227. data/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb +10 -10
  228. data/spec/unit/mixin/template_spec.rb +5 -1
  229. data/spec/unit/mixin/windows_architecture_helper_spec.rb +13 -8
  230. data/spec/unit/node_spec.rb +213 -0
  231. data/spec/unit/platform/query_helpers_spec.rb +146 -3
  232. data/spec/unit/policy_builder/dynamic_spec.rb +275 -0
  233. data/spec/unit/policy_builder/expand_node_object_spec.rb +37 -38
  234. data/spec/unit/policy_builder/policyfile_spec.rb +260 -46
  235. data/spec/unit/property/validation_spec.rb +5 -0
  236. data/spec/unit/property_spec.rb +152 -26
  237. data/spec/unit/provider/deploy_spec.rb +5 -5
  238. data/spec/unit/provider/directory_spec.rb +35 -0
  239. data/spec/unit/provider/dsc_resource_spec.rb +3 -10
  240. data/spec/unit/provider/ifconfig_spec.rb +22 -2
  241. data/spec/unit/provider/mount/aix_spec.rb +2 -1
  242. data/spec/unit/provider/mount/mount_spec.rb +6 -0
  243. data/spec/unit/provider/mount/windows_spec.rb +14 -0
  244. data/spec/unit/provider/mount_spec.rb +12 -1
  245. data/spec/unit/provider/package/dpkg_spec.rb +8 -1
  246. data/spec/unit/provider/package/rpm_spec.rb +18 -1
  247. data/spec/unit/provider/package/rubygems_spec.rb +18 -0
  248. data/spec/unit/provider/package/yum_spec.rb +97 -24
  249. data/spec/unit/provider/powershell_script_spec.rb +52 -26
  250. data/spec/unit/provider/remote_directory_spec.rb +1 -2
  251. data/spec/unit/provider/service/aix_service_spec.rb +3 -3
  252. data/spec/unit/provider/service/gentoo_service_spec.rb +4 -4
  253. data/spec/unit/provider/service/openbsd_service_spec.rb +10 -8
  254. data/spec/unit/provider/service/redhat_spec.rb +88 -8
  255. data/spec/unit/provider/service/upstart_service_spec.rb +11 -7
  256. data/spec/unit/provider/service/windows_spec.rb +211 -200
  257. data/spec/unit/provider/subversion_spec.rb +50 -31
  258. data/spec/unit/provider/template/content_spec.rb +93 -2
  259. data/spec/unit/provider/user/solaris_spec.rb +66 -9
  260. data/spec/unit/provider_resolver_spec.rb +707 -650
  261. data/spec/unit/resource/deploy_spec.rb +7 -1
  262. data/spec/unit/resource/dsc_script_spec.rb +4 -0
  263. data/spec/unit/resource/file/verification_spec.rb +1 -1
  264. data/spec/unit/resource/powershell_script_spec.rb +17 -13
  265. data/spec/unit/resource/service_spec.rb +4 -4
  266. data/spec/unit/resource/subversion_spec.rb +4 -0
  267. data/spec/unit/resource/yum_package_spec.rb +10 -1
  268. data/spec/unit/run_list/versioned_recipe_list_spec.rb +5 -0
  269. data/spec/unit/win32/registry_spec.rb +394 -0
  270. data/tasks/external_tests.rb +47 -23
  271. data/tasks/maintainers.rb +155 -14
  272. metadata +51 -26
  273. data/lib/chef/knife/bootstrap/templates/archlinux-gems.erb +0 -76
  274. data/lib/chef/knife/bootstrap/templates/chef-aix.erb +0 -72
  275. data/spec/unit/registry_helper_spec.rb +0 -390
@@ -1,29 +1,53 @@
1
- task :chef_sugar_spec do
2
- gem_path = Bundler.environment.specs['chef-sugar'].first.full_gem_path
3
- system("cd #{gem_path} && rake")
4
- end
1
+ require 'tempfile'
5
2
 
6
- task :foodcritic_spec do
7
- gem_path = Bundler.environment.specs['foodcritic'].first.full_gem_path
8
- system("cd #{gem_path} && rake test")
3
+ def bundle_exec_with_chef(test_gem, commands)
4
+ gem_path = Bundler.environment.specs[test_gem].first.full_gem_path
5
+ gemfile_path = File.join(gem_path, 'Gemfile.chef-external-test')
6
+ gemfile = File.open(gemfile_path, "w")
7
+ begin
8
+ IO.read(File.join(gem_path, 'Gemfile')).each_line do |line|
9
+ if line =~ /^\s*gemspec/
10
+ next
11
+ elsif line =~ /^\s*gem 'chef'|\s*gem "chef"/
12
+ next
13
+ elsif line =~ /^\s*dev_gem\s*['"](.+)['"]\s*$/
14
+ line = "gem '#{$1}', github: 'poise/#{$1}'"
15
+ elsif line =~ /\s*gem\s*['"]#{test_gem}['"]/ # foodcritic
16
+ next
17
+ end
18
+ gemfile.puts(line)
19
+ end
20
+ gemfile.puts("gem 'chef', path: #{File.expand_path('../..', __FILE__).inspect}")
21
+ gemfile.puts("gemspec path: #{gem_path.inspect}")
22
+ gemfile.close
23
+ Dir.chdir(gem_path) do
24
+ system({ 'BUNDLE_GEMFILE' => gemfile.path, 'RUBYOPT' => nil }, "bundle install")
25
+ Array(commands).each do |command|
26
+ system({ 'BUNDLE_GEMFILE' => gemfile.path, 'RUBYOPT' => nil }, "bundle exec #{command}")
27
+ end
28
+ end
29
+ ensure
30
+ File.delete(gemfile_path)
31
+ end
9
32
  end
10
33
 
11
- task :chefspec_spec do
12
- gem_path = Bundler.environment.specs['chefspec'].first.full_gem_path
13
- system("cd #{gem_path} && rake")
14
- end
34
+ EXTERNAL_PROJECTS = {
35
+ "chef-zero" => [ "rake spec", "rake pedant" ],
36
+ "cheffish" => "rake spec",
37
+ "chef-provisioning" => "rake spec",
38
+ "chef-provisioning-aws" => "rake spec",
39
+ "chef-sugar" => "rake",
40
+ "foodcritic" => "rake test",
41
+ "chefspec" => "rake",
42
+ "chef-rewind" => "rake spec",
43
+ "poise" => "rake spec",
44
+ "halite" => "rake spec"
45
+ }
15
46
 
16
- task :chef_rewind_spec do
17
- gem_path = Bundler.environment.specs['chef-rewind'].first.full_gem_path
18
- system("cd #{gem_path} && rake spec")
19
- end
20
-
21
- task :poise_spec do
22
- gem_path = Bundler.environment.specs['poise'].first.full_gem_path
23
- system("cd #{gem_path} && rake spec")
24
- end
47
+ task :external_specs => EXTERNAL_PROJECTS.keys.map { |g| :"#{g.sub("-","_")}_spec" }
25
48
 
26
- task :halite_spec do
27
- gem_path = Bundler.environment.specs['halite'].first.full_gem_path
28
- system("cd #{gem_path} && rake spec")
49
+ EXTERNAL_PROJECTS.each do |test_gem, commands|
50
+ task :"#{test_gem.gsub('-','_')}_spec" do
51
+ bundle_exec_with_chef(test_gem, commands)
52
+ end
29
53
  end
@@ -20,50 +20,191 @@ require 'rake'
20
20
  SOURCE = File.join(File.dirname(__FILE__), "..", "MAINTAINERS.toml")
21
21
  TARGET = File.join(File.dirname(__FILE__), "..", "MAINTAINERS.md")
22
22
 
23
+ # The list of repositories that teams should own
24
+ REPOSITORIES = ["chef/chef", "chef/chef-census", "chef/chef-repo",
25
+ "chef/client-docs", "chef/ffi-yajl", "chef/libyajl2-gem",
26
+ "chef/mixlib-authentication", "chef/mixlib-cli",
27
+ "chef/mixlib-config", "chef/mixlib-install", "chef/mixlib-log",
28
+ "chef/mixlib-shellout", "chef/ohai", "chef/omnibus-chef"]
29
+
23
30
  begin
24
31
  require 'tomlrb'
32
+ require 'octokit'
33
+ require 'pp'
25
34
  task :default => :generate
26
35
 
27
36
  namespace :maintainers do
28
37
  desc "Generate MarkDown version of MAINTAINERS file"
29
38
  task :generate do
30
- maintainers = Tomlrb.load_file SOURCE
31
39
  out = "<!-- This is a generated file. Please do not edit directly -->\n\n"
32
- out << "# " + maintainers["Preamble"]["title"] + "\n\n"
33
- out << maintainers["Preamble"]["text"] + "\n"
34
- out << "# " + maintainers["Org"]["Lead"]["title"] + "\n\n"
35
- out << person(maintainers["people"], maintainers["Org"]["Lead"]["person"]) + "\n\n"
36
- out << components(maintainers["people"], maintainers["Org"]["Components"])
40
+ out << "# " + source["Preamble"]["title"] + "\n\n"
41
+ out << source["Preamble"]["text"] + "\n"
42
+
43
+ # The project lead is a special case
44
+ out << "# " + source["Org"]["Lead"]["title"] + "\n\n"
45
+ out << format_person(source["Org"]["Lead"]["person"]) + "\n\n"
46
+
47
+ out << format_components(source["Org"]["Components"])
37
48
  File.open(TARGET, "w") { |fn|
38
49
  fn.write out
39
50
  }
40
51
  end
52
+
53
+ desc "Synchronize GitHub teams"
54
+ # there's a special @chef/client-maintainers team that's everyone
55
+ # and then there's a team per component
56
+ task :synchronize do
57
+ Octokit.auto_paginate = true
58
+ get_github_teams
59
+ prepare_teams(source["Org"]["Components"].dup)
60
+ sync_teams!
61
+ end
62
+ end
63
+
64
+ def github
65
+ @github ||= Octokit::Client.new(:netrc => true)
66
+ end
67
+
68
+ def source
69
+ @source ||= Tomlrb.load_file SOURCE
41
70
  end
42
71
 
43
- def components(list, cmp)
72
+ def teams
73
+ @teams ||= {"client-maintainers" => {"title" => "Client Maintainers"}}
74
+ end
75
+
76
+ def add_members(team, name)
77
+ teams["client-maintainers"]["members"] ||= []
78
+ teams["client-maintainers"]["members"] << name
79
+ teams[team] ||= {}
80
+ teams[team]["members"] ||= []
81
+ teams[team]["members"] << name
82
+ end
83
+
84
+ def set_team_title(team, title)
85
+ teams[team] ||= {}
86
+ teams[team]["title"] = title
87
+ end
88
+
89
+ def gh_teams
90
+ @gh_teams ||= {}
91
+ end
92
+
93
+ # we have to resolve team names to ids. While we're at it, we can get the privacy
94
+ # setting, so we know whether we need to update it
95
+ def get_github_teams
96
+ github.org_teams("chef").each do |team|
97
+ gh_teams[team[:slug]] = {"id" => team[:id], "privacy" => team[:privacy]}
98
+ end
99
+ end
100
+
101
+ def get_github_team(team)
102
+ github.team_members(gh_teams[team]["id"]).map do |member|
103
+ member[:login]
104
+ end.sort.uniq.map(&:downcase)
105
+ rescue
106
+ []
107
+ end
108
+
109
+ def create_team(team)
110
+ puts "creating new github team: #{team} with title: #{teams[team]["title"]} "
111
+ t = github.create_team("chef", name: team, description: teams[team]["title"],
112
+ privacy: "closed", repo_names: REPOSITORIES,
113
+ accept: "application/vnd.github.ironman-preview+json")
114
+ gh_teams[team] = { "id" => t[:id], "privacy" => t[:privacy] }
115
+ end
116
+
117
+ def compare_teams(current, desired)
118
+ # additions are the subtraction of the current state from the desired state
119
+ # deletions are the subtraction of the desired state from the current state
120
+ [desired - current, current - desired]
121
+ end
122
+
123
+ def prepare_teams(cmp)
124
+ %w(text paths).each { |k| cmp.delete(k) }
125
+ if cmp.key?("team")
126
+ team = cmp.delete("team")
127
+ add_members(team, cmp.delete("lieutenant")) if cmp.key?("lieutenant")
128
+ add_members(team, cmp.delete("maintainers")) if cmp.key?("maintainers")
129
+ set_team_title(team, cmp.delete("title"))
130
+ else
131
+ %w(maintainers lieutenant title).each { |k| cmp.delete(k) }
132
+ end
133
+ cmp.each { |_k, v| prepare_teams(v) }
134
+ end
135
+
136
+ def update_team(team, additions, deletions)
137
+ create_team(team) unless gh_teams.key?(team)
138
+ update_team_privacy(team)
139
+ add_team_members(team, additions)
140
+ remove_team_members(team, deletions)
141
+ rescue
142
+ puts "failed for #{team}"
143
+ end
144
+
145
+ def update_team_privacy(team)
146
+ return if gh_teams[team]["privacy"] == "closed"
147
+ puts "Setting #{team} privacy to closed from #{gh_teams[team]["privacy"]}"
148
+ github.update_team(gh_teams[team]["id"], privacy: "closed",
149
+ accept: "application/vnd.github.ironman-preview+json")
150
+ end
151
+
152
+ def add_team_members(team, additions)
153
+ additions.each do |member|
154
+ puts "Adding #{member} to #{team}"
155
+ github.add_team_membership(gh_teams[team]["id"], member, role: "member",
156
+ accept: "application/vnd.github.ironman-preview+json")
157
+ end
158
+ end
159
+
160
+ def remove_team_members(team, deletions)
161
+ deletions.each do |member|
162
+ puts "Removing #{member} from #{team}"
163
+ github.remove_team_membership(gh_teams[team]["id"], member,
164
+ accept: "application/vnd.github.ironman-preview+json")
165
+ end
166
+ end
167
+
168
+ def sync_teams!
169
+ teams.each do |name, details|
170
+ current = get_github_team(name)
171
+ desired = details["members"].flatten.sort.uniq.map(&:downcase)
172
+ additions, deletions = compare_teams(current, desired)
173
+ update_team(name, additions, deletions)
174
+ end
175
+ end
176
+
177
+ def get_person(person)
178
+ source["people"][person]
179
+ end
180
+
181
+ def format_components(cmp)
44
182
  out = "## " + cmp.delete("title") + "\n\n"
45
183
  out << cmp.delete("text") + "\n" if cmp.has_key?("text")
184
+ out << "To mention the team, use @chef/#{cmp.delete("team")}\n\n" if cmp.has_key?("team")
46
185
  if cmp.has_key?("lieutenant")
47
186
  out << "### Lieutenant\n\n"
48
- out << person(list, cmp.delete("lieutenant")) + "\n\n"
187
+ out << format_person(cmp.delete("lieutenant")) + "\n\n"
49
188
  end
50
- out << maintainers(list, cmp.delete("maintainers")) + "\n" if cmp.has_key?("maintainers")
189
+ out << format_maintainers(cmp.delete("maintainers")) + "\n" if cmp.has_key?("maintainers")
51
190
  cmp.delete("paths")
52
- cmp.each {|k,v| out << components(list, v) }
191
+ cmp.each {|k,v| out << format_components(v) }
53
192
  out
54
193
  end
55
194
 
56
- def maintainers(list, people)
195
+ def format_maintainers(people)
57
196
  o = "### Maintainers\n\n"
58
197
  people.each do |p|
59
- o << person(list, p) + "\n"
198
+ o << format_person(p) + "\n"
60
199
  end
61
200
  o
62
201
  end
63
202
 
64
- def person(list, person)
65
- "* [#{list[person]["Name"]}](https://github.com/#{list[person]["GitHub"]})"
203
+ def format_person(person)
204
+ mnt = get_person(person)
205
+ "* [#{mnt["Name"]}](https://github.com/#{mnt["GitHub"]})"
66
206
  end
207
+
67
208
  rescue LoadError
68
209
  STDERR.puts "\n*** TomlRb not available.\n\n"
69
210
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.5.0.alpha.1
4
+ version: 12.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-23 00:00:00.000000000 Z
11
+ date: 2015-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-config
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 12.5.0.alpha.1
19
+ version: 12.5.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 12.5.0.alpha.1
26
+ version: 12.5.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mixlib-cli
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -70,36 +70,36 @@ dependencies:
70
70
  name: mixlib-shellout
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: 2.0.0.rc.0
76
- - - "<"
73
+ - - "~>"
77
74
  - !ruby/object:Gem::Version
78
- version: '3.0'
75
+ version: '2.0'
79
76
  type: :runtime
80
77
  prerelease: false
81
78
  version_requirements: !ruby/object:Gem::Requirement
82
79
  requirements:
83
- - - ">="
84
- - !ruby/object:Gem::Version
85
- version: 2.0.0.rc.0
86
- - - "<"
80
+ - - "~>"
87
81
  - !ruby/object:Gem::Version
88
- version: '3.0'
82
+ version: '2.0'
89
83
  - !ruby/object:Gem::Dependency
90
84
  name: ohai
91
85
  requirement: !ruby/object:Gem::Requirement
92
86
  requirements:
93
- - - "~>"
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 8.6.0.alpha.1
90
+ - - "<"
94
91
  - !ruby/object:Gem::Version
95
- version: '8.0'
92
+ version: '9'
96
93
  type: :runtime
97
94
  prerelease: false
98
95
  version_requirements: !ruby/object:Gem::Requirement
99
96
  requirements:
100
- - - "~>"
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: 8.6.0.alpha.1
100
+ - - "<"
101
101
  - !ruby/object:Gem::Version
102
- version: '8.0'
102
+ version: '9'
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: ffi-yajl
105
105
  requirement: !ruby/object:Gem::Requirement
@@ -400,6 +400,7 @@ extra_rdoc_files:
400
400
  - LICENSE
401
401
  files:
402
402
  - CONTRIBUTING.md
403
+ - Gemfile
403
404
  - LICENSE
404
405
  - README.md
405
406
  - Rakefile
@@ -685,6 +686,7 @@ files:
685
686
  - lib/chef/deprecation/mixin/template.rb
686
687
  - lib/chef/deprecation/provider/cookbook_file.rb
687
688
  - lib/chef/deprecation/provider/file.rb
689
+ - lib/chef/deprecation/provider/remote_directory.rb
688
690
  - lib/chef/deprecation/provider/remote_file.rb
689
691
  - lib/chef/deprecation/provider/template.rb
690
692
  - lib/chef/deprecation/warnings.rb
@@ -774,8 +776,6 @@ files:
774
776
  - lib/chef/knife/bootstrap/chef_vault_handler.rb
775
777
  - lib/chef/knife/bootstrap/client_builder.rb
776
778
  - lib/chef/knife/bootstrap/templates/README.md
777
- - lib/chef/knife/bootstrap/templates/archlinux-gems.erb
778
- - lib/chef/knife/bootstrap/templates/chef-aix.erb
779
779
  - lib/chef/knife/bootstrap/templates/chef-full.erb
780
780
  - lib/chef/knife/client_bulk_delete.rb
781
781
  - lib/chef/knife/client_create.rb
@@ -811,7 +811,10 @@ files:
811
811
  - lib/chef/knife/cookbook_upload.rb
812
812
  - lib/chef/knife/core/bootstrap_context.rb
813
813
  - lib/chef/knife/core/cookbook_scm_repo.rb
814
+ - lib/chef/knife/core/custom_manifest_loader.rb
815
+ - lib/chef/knife/core/gem_glob_loader.rb
814
816
  - lib/chef/knife/core/generic_presenter.rb
817
+ - lib/chef/knife/core/hashed_command_loader.rb
815
818
  - lib/chef/knife/core/node_editor.rb
816
819
  - lib/chef/knife/core/node_presenter.rb
817
820
  - lib/chef/knife/core/object_loader.rb
@@ -862,6 +865,7 @@ files:
862
865
  - lib/chef/knife/node_run_list_remove.rb
863
866
  - lib/chef/knife/node_run_list_set.rb
864
867
  - lib/chef/knife/node_show.rb
868
+ - lib/chef/knife/null.rb
865
869
  - lib/chef/knife/osc_user_create.rb
866
870
  - lib/chef/knife/osc_user_delete.rb
867
871
  - lib/chef/knife/osc_user_edit.rb
@@ -870,6 +874,7 @@ files:
870
874
  - lib/chef/knife/osc_user_show.rb
871
875
  - lib/chef/knife/raw.rb
872
876
  - lib/chef/knife/recipe_list.rb
877
+ - lib/chef/knife/rehash.rb
873
878
  - lib/chef/knife/role_bulk_delete.rb
874
879
  - lib/chef/knife/role_create.rb
875
880
  - lib/chef/knife/role_delete.rb
@@ -946,13 +951,15 @@ files:
946
951
  - lib/chef/mixin/uris.rb
947
952
  - lib/chef/mixin/which.rb
948
953
  - lib/chef/mixin/why_run.rb
954
+ - lib/chef/mixin/wide_string.rb
949
955
  - lib/chef/mixin/windows_architecture_helper.rb
950
956
  - lib/chef/mixin/windows_env_helper.rb
951
- - lib/chef/mixin/wstring.rb
952
957
  - lib/chef/mixin/xml_escape.rb
953
958
  - lib/chef/mixins.rb
954
959
  - lib/chef/monkey_patches/net-ssh-multi.rb
955
960
  - lib/chef/monkey_patches/net_http.rb
961
+ - lib/chef/monkey_patches/webrick-utils.rb
962
+ - lib/chef/monkey_patches/win32/registry.rb
956
963
  - lib/chef/monologger.rb
957
964
  - lib/chef/nil_argument.rb
958
965
  - lib/chef/node.rb
@@ -974,6 +981,7 @@ files:
974
981
  - lib/chef/platform/resource_priority_map.rb
975
982
  - lib/chef/platform/service_helpers.rb
976
983
  - lib/chef/policy_builder.rb
984
+ - lib/chef/policy_builder/dynamic.rb
977
985
  - lib/chef/policy_builder/expand_node_object.rb
978
986
  - lib/chef/policy_builder/policyfile.rb
979
987
  - lib/chef/property.rb
@@ -1102,6 +1110,7 @@ files:
1102
1110
  - lib/chef/request_id.rb
1103
1111
  - lib/chef/reserved_names.rb
1104
1112
  - lib/chef/resource.rb
1113
+ - lib/chef/resource/action_class.rb
1105
1114
  - lib/chef/resource/apt_package.rb
1106
1115
  - lib/chef/resource/bash.rb
1107
1116
  - lib/chef/resource/batch.rb
@@ -1243,6 +1252,7 @@ files:
1243
1252
  - lib/chef/win32/api/net.rb
1244
1253
  - lib/chef/win32/api/process.rb
1245
1254
  - lib/chef/win32/api/psapi.rb
1255
+ - lib/chef/win32/api/registry.rb
1246
1256
  - lib/chef/win32/api/security.rb
1247
1257
  - lib/chef/win32/api/synchronization.rb
1248
1258
  - lib/chef/win32/api/system.rb
@@ -1265,6 +1275,7 @@ files:
1265
1275
  - lib/chef/win32/security/security_descriptor.rb
1266
1276
  - lib/chef/win32/security/sid.rb
1267
1277
  - lib/chef/win32/security/token.rb
1278
+ - lib/chef/win32/system.rb
1268
1279
  - lib/chef/win32/unicode.rb
1269
1280
  - lib/chef/win32/version.rb
1270
1281
  - lib/chef/workstation_config_loader.rb
@@ -1382,7 +1393,10 @@ files:
1382
1393
  - spec/data/cookbooks/openldap/recipes/return.rb
1383
1394
  - spec/data/cookbooks/openldap/templates/default/all_windows_line_endings.erb
1384
1395
  - spec/data/cookbooks/openldap/templates/default/helper_test.erb
1396
+ - spec/data/cookbooks/openldap/templates/default/helpers.erb
1385
1397
  - spec/data/cookbooks/openldap/templates/default/helpers_via_partial_test.erb
1398
+ - spec/data/cookbooks/openldap/templates/default/nested_openldap_partials.erb
1399
+ - spec/data/cookbooks/openldap/templates/default/nested_partial.erb
1386
1400
  - spec/data/cookbooks/openldap/templates/default/no_windows_line_endings.erb
1387
1401
  - spec/data/cookbooks/openldap/templates/default/openldap_stuff.conf.erb
1388
1402
  - spec/data/cookbooks/openldap/templates/default/openldap_variable_stuff.conf.erb
@@ -1394,6 +1408,7 @@ files:
1394
1408
  - spec/data/cookbooks/preseed/templates/default/preseed-template-variables.seed
1395
1409
  - spec/data/cookbooks/preseed/templates/default/preseed-template.seed
1396
1410
  - spec/data/definitions/test.rb
1411
+ - spec/data/dsc_lcm.pfx
1397
1412
  - spec/data/environment-config.rb
1398
1413
  - spec/data/file-providers-method-snapshot-chef-11-4.json
1399
1414
  - spec/data/fileedit/blank
@@ -1613,7 +1628,7 @@ files:
1613
1628
  - spec/functional/util/powershell/cmdlet_spec.rb
1614
1629
  - spec/functional/version_spec.rb
1615
1630
  - spec/functional/win32/crypto_spec.rb
1616
- - spec/functional/win32/registry_helper_spec.rb
1631
+ - spec/functional/win32/registry_spec.rb
1617
1632
  - spec/functional/win32/security_spec.rb
1618
1633
  - spec/functional/win32/service_manager_spec.rb
1619
1634
  - spec/functional/win32/sid_spec.rb
@@ -1640,7 +1655,10 @@ files:
1640
1655
  - spec/integration/recipes/lwrp_spec.rb
1641
1656
  - spec/integration/recipes/provider_choice.rb
1642
1657
  - spec/integration/recipes/recipe_dsl_spec.rb
1658
+ - spec/integration/recipes/remote_directory.rb
1643
1659
  - spec/integration/recipes/resource_action_spec.rb
1660
+ - spec/integration/recipes/resource_converge_if_changed_spec.rb
1661
+ - spec/integration/recipes/resource_load_spec.rb
1644
1662
  - spec/integration/solo/solo_spec.rb
1645
1663
  - spec/rcov.opts
1646
1664
  - spec/scripts/ssl-serve.rb
@@ -1673,6 +1691,7 @@ files:
1673
1691
  - spec/support/platforms/win32/spec_service.rb
1674
1692
  - spec/support/shared/context/client.rb
1675
1693
  - spec/support/shared/context/config.rb
1694
+ - spec/support/shared/context/win32.rb
1676
1695
  - spec/support/shared/examples/client.rb
1677
1696
  - spec/support/shared/functional/diff_disabled.rb
1678
1697
  - spec/support/shared/functional/directory_resource.rb
@@ -1694,6 +1713,7 @@ files:
1694
1713
  - spec/support/shared/unit/execute_resource.rb
1695
1714
  - spec/support/shared/unit/file_system_support.rb
1696
1715
  - spec/support/shared/unit/knife_shared.rb
1716
+ - spec/support/shared/unit/mock_shellout.rb
1697
1717
  - spec/support/shared/unit/platform_introspector.rb
1698
1718
  - spec/support/shared/unit/provider/file.rb
1699
1719
  - spec/support/shared/unit/provider/useradd_based_user_provider.rb
@@ -1730,6 +1750,7 @@ files:
1730
1750
  - spec/unit/chef_spec.rb
1731
1751
  - spec/unit/client_spec.rb
1732
1752
  - spec/unit/config_fetcher_spec.rb
1753
+ - spec/unit/config_spec.rb
1733
1754
  - spec/unit/cookbook/chefignore_spec.rb
1734
1755
  - spec/unit/cookbook/cookbook_version_loader_spec.rb
1735
1756
  - spec/unit/cookbook/file_vendor_spec.rb
@@ -1819,6 +1840,9 @@ files:
1819
1840
  - spec/unit/knife/cookbook_upload_spec.rb
1820
1841
  - spec/unit/knife/core/bootstrap_context_spec.rb
1821
1842
  - spec/unit/knife/core/cookbook_scm_repo_spec.rb
1843
+ - spec/unit/knife/core/custom_manifest_loader_spec.rb
1844
+ - spec/unit/knife/core/gem_glob_loader_spec.rb
1845
+ - spec/unit/knife/core/hashed_command_loader_spec.rb
1822
1846
  - spec/unit/knife/core/object_loader_spec.rb
1823
1847
  - spec/unit/knife/core/subcommand_loader_spec.rb
1824
1848
  - spec/unit/knife/core/ui_spec.rb
@@ -1923,6 +1947,7 @@ files:
1923
1947
  - spec/unit/org_spec.rb
1924
1948
  - spec/unit/platform/query_helpers_spec.rb
1925
1949
  - spec/unit/platform_spec.rb
1950
+ - spec/unit/policy_builder/dynamic_spec.rb
1926
1951
  - spec/unit/policy_builder/expand_node_object_spec.rb
1927
1952
  - spec/unit/policy_builder/policyfile_spec.rb
1928
1953
  - spec/unit/policy_builder_spec.rb
@@ -2039,7 +2064,6 @@ files:
2039
2064
  - spec/unit/provider_spec.rb
2040
2065
  - spec/unit/pure_application_spec.rb
2041
2066
  - spec/unit/recipe_spec.rb
2042
- - spec/unit/registry_helper_spec.rb
2043
2067
  - spec/unit/resource/apt_package_spec.rb
2044
2068
  - spec/unit/resource/bash_spec.rb
2045
2069
  - spec/unit/resource/batch_spec.rb
@@ -2150,6 +2174,7 @@ files:
2150
2174
  - spec/unit/version_class_spec.rb
2151
2175
  - spec/unit/version_constraint/platform_spec.rb
2152
2176
  - spec/unit/version_constraint_spec.rb
2177
+ - spec/unit/win32/registry_spec.rb
2153
2178
  - spec/unit/windows_service_spec.rb
2154
2179
  - tasks/external_tests.rb
2155
2180
  - tasks/maintainers.rb
@@ -2169,12 +2194,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
2169
2194
  version: 2.0.0
2170
2195
  required_rubygems_version: !ruby/object:Gem::Requirement
2171
2196
  requirements:
2172
- - - ">"
2197
+ - - ">="
2173
2198
  - !ruby/object:Gem::Version
2174
- version: 1.3.1
2199
+ version: '0'
2175
2200
  requirements: []
2176
2201
  rubyforge_project:
2177
- rubygems_version: 2.4.4
2202
+ rubygems_version: 2.4.5
2178
2203
  signing_key:
2179
2204
  specification_version: 4
2180
2205
  summary: A systems integration framework, built to bring the benefits of configuration