chef 11.18.12-x86-mingw32 → 12.0.0.alpha.0-x86-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (307) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +10 -0
  3. data/README.md +1 -1
  4. data/distro/common/html/_sources/index.txt +5 -2
  5. data/distro/common/html/_sources/knife_serve.txt +19 -0
  6. data/distro/common/html/_sources/knife_ssl_check.txt +2 -2
  7. data/distro/common/html/_sources/knife_ssl_fetch.txt +2 -2
  8. data/distro/common/html/_static/basic.css +1 -1
  9. data/distro/common/html/_static/doctools.js +1 -1
  10. data/distro/common/html/_static/searchtools.js +1 -1
  11. data/distro/common/html/_static/websupport.js +1 -1
  12. data/distro/common/html/ctl_chef_client.html +19 -9
  13. data/distro/common/html/ctl_chef_server.html +7 -1
  14. data/distro/common/html/ctl_chef_shell.html +3 -4
  15. data/distro/common/html/ctl_chef_solo.html +12 -7
  16. data/distro/common/html/index.html +19 -12
  17. data/distro/common/html/knife.html +1 -2
  18. data/distro/common/html/knife_bootstrap.html +16 -5
  19. data/distro/common/html/knife_client.html +8 -5
  20. data/distro/common/html/knife_common_options.html +11 -12
  21. data/distro/common/html/knife_configure.html +2 -3
  22. data/distro/common/html/knife_cookbook.html +16 -17
  23. data/distro/common/html/knife_cookbook_site.html +19 -18
  24. data/distro/common/html/knife_data_bag.html +6 -7
  25. data/distro/common/html/knife_delete.html +2 -3
  26. data/distro/common/html/knife_deps.html +2 -3
  27. data/distro/common/html/knife_diff.html +3 -4
  28. data/distro/common/html/knife_download.html +6 -7
  29. data/distro/common/html/knife_edit.html +0 -1
  30. data/distro/common/html/knife_environment.html +3 -4
  31. data/distro/common/html/knife_exec.html +0 -1
  32. data/distro/common/html/knife_index_rebuild.html +0 -1
  33. data/distro/common/html/knife_list.html +5 -6
  34. data/distro/common/html/knife_node.html +13 -6
  35. data/distro/common/html/knife_raw.html +0 -1
  36. data/distro/common/html/knife_recipe_list.html +0 -1
  37. data/distro/common/html/knife_role.html +1 -2
  38. data/distro/common/html/knife_search.html +2 -3
  39. data/distro/common/html/knife_serve.html +79 -0
  40. data/distro/common/html/knife_show.html +1 -2
  41. data/distro/common/html/knife_ssh.html +2 -3
  42. data/distro/common/html/knife_ssl_check.html +12 -9
  43. data/distro/common/html/knife_ssl_fetch.html +9 -10
  44. data/distro/common/html/knife_status.html +2 -3
  45. data/distro/common/html/knife_tag.html +0 -1
  46. data/distro/common/html/knife_upload.html +3 -4
  47. data/distro/common/html/knife_user.html +2 -3
  48. data/distro/common/html/knife_using.html +0 -1
  49. data/distro/common/html/knife_xargs.html +3 -4
  50. data/distro/common/html/search.html +0 -1
  51. data/distro/common/html/searchindex.js +1 -1
  52. data/lib/chef/api_client.rb +1 -1
  53. data/lib/chef/application.rb +24 -67
  54. data/lib/chef/application/client.rb +1 -1
  55. data/lib/chef/application/knife.rb +1 -1
  56. data/lib/chef/chef_fs/chef_fs_data_store.rb +2 -3
  57. data/lib/chef/chef_fs/command_line.rb +2 -3
  58. data/lib/chef/chef_fs/data_handler/group_data_handler.rb +1 -5
  59. data/lib/chef/chef_fs/file_system/acl_entry.rb +1 -2
  60. data/lib/chef/chef_fs/file_system/chef_repository_file_system_entry.rb +1 -2
  61. data/lib/chef/chef_fs/file_system/cookbooks_dir.rb +2 -2
  62. data/lib/chef/chef_fs/file_system/rest_list_dir.rb +2 -3
  63. data/lib/chef/chef_fs/file_system/rest_list_entry.rb +4 -5
  64. data/lib/chef/config.rb +26 -2
  65. data/lib/chef/config_fetcher.rb +1 -1
  66. data/lib/chef/cookbook/cookbook_version_loader.rb +4 -4
  67. data/lib/chef/cookbook/metadata.rb +1 -1
  68. data/lib/chef/cookbook/synchronizer.rb +50 -8
  69. data/lib/chef/cookbook_uploader.rb +9 -23
  70. data/lib/chef/cookbook_version.rb +3 -2
  71. data/lib/chef/data_bag.rb +1 -1
  72. data/lib/chef/data_bag_item.rb +1 -1
  73. data/lib/chef/dsl/recipe.rb +1 -14
  74. data/lib/chef/encrypted_data_bag_item/decryptor.rb +3 -3
  75. data/lib/chef/environment.rb +1 -1
  76. data/lib/chef/exceptions.rb +2 -24
  77. data/lib/chef/file_content_management/tempfile.rb +8 -1
  78. data/lib/chef/formatters/base.rb +0 -7
  79. data/lib/chef/http.rb +12 -19
  80. data/lib/chef/http/json_input.rb +12 -1
  81. data/lib/chef/json_compat.rb +45 -64
  82. data/lib/chef/knife.rb +2 -5
  83. data/lib/chef/knife/bootstrap.rb +2 -2
  84. data/lib/chef/knife/bootstrap/archlinux-gems.erb +2 -2
  85. data/lib/chef/knife/bootstrap/centos5-gems.erb +2 -2
  86. data/lib/chef/knife/bootstrap/chef-aix.erb +2 -2
  87. data/lib/chef/knife/bootstrap/chef-full.erb +2 -2
  88. data/lib/chef/knife/bootstrap/fedora13-gems.erb +2 -2
  89. data/lib/chef/knife/bootstrap/ubuntu10.04-apt.erb +2 -2
  90. data/lib/chef/knife/bootstrap/ubuntu10.04-gems.erb +2 -2
  91. data/lib/chef/knife/bootstrap/ubuntu12.04-gems.erb +2 -2
  92. data/lib/chef/knife/cookbook_site_download.rb +1 -1
  93. data/lib/chef/knife/cookbook_site_install.rb +10 -34
  94. data/lib/chef/knife/cookbook_site_list.rb +1 -1
  95. data/lib/chef/knife/cookbook_site_search.rb +1 -1
  96. data/lib/chef/knife/cookbook_site_share.rb +3 -3
  97. data/lib/chef/knife/cookbook_site_show.rb +3 -3
  98. data/lib/chef/knife/cookbook_site_unshare.rb +1 -1
  99. data/lib/chef/knife/cookbook_upload.rb +1 -1
  100. data/lib/chef/knife/core/subcommand_loader.rb +0 -24
  101. data/lib/chef/knife/core/ui.rb +8 -7
  102. data/lib/chef/knife/deps.rb +2 -3
  103. data/lib/chef/knife/serve.rb +2 -1
  104. data/lib/chef/local_mode.rb +105 -0
  105. data/lib/chef/mixin/file_class.rb +1 -4
  106. data/lib/chef/mixin/shell_out.rb +15 -0
  107. data/lib/chef/mixin/windows_architecture_helper.rb +0 -16
  108. data/lib/chef/node.rb +1 -1
  109. data/lib/chef/platform/query_helpers.rb +1 -5
  110. data/lib/chef/policy_builder/expand_node_object.rb +3 -0
  111. data/lib/chef/provider.rb +2 -0
  112. data/lib/chef/provider/cookbook_file.rb +0 -1
  113. data/lib/chef/provider/deploy.rb +0 -1
  114. data/lib/chef/provider/deploy/revision.rb +1 -1
  115. data/lib/chef/provider/env.rb +10 -25
  116. data/lib/chef/provider/env/windows.rb +23 -10
  117. data/lib/chef/provider/execute.rb +0 -3
  118. data/lib/chef/provider/file.rb +0 -3
  119. data/lib/chef/provider/git.rb +0 -6
  120. data/lib/chef/provider/group/dscl.rb +9 -27
  121. data/lib/chef/provider/group/gpasswd.rb +0 -3
  122. data/lib/chef/provider/group/groupmod.rb +0 -4
  123. data/lib/chef/provider/group/suse.rb +0 -3
  124. data/lib/chef/provider/group/usermod.rb +0 -3
  125. data/lib/chef/provider/link.rb +22 -5
  126. data/lib/chef/provider/log.rb +15 -4
  127. data/lib/chef/provider/mdadm.rb +0 -3
  128. data/lib/chef/provider/mount/mount.rb +0 -2
  129. data/lib/chef/provider/mount/solaris.rb +0 -2
  130. data/lib/chef/provider/package.rb +0 -1
  131. data/lib/chef/provider/package/apt.rb +0 -3
  132. data/lib/chef/provider/package/dpkg.rb +0 -1
  133. data/lib/chef/provider/package/easy_install.rb +0 -4
  134. data/lib/chef/provider/package/freebsd/base.rb +0 -3
  135. data/lib/chef/provider/package/freebsd/pkgng.rb +0 -2
  136. data/lib/chef/provider/package/freebsd/port.rb +0 -2
  137. data/lib/chef/provider/package/ips.rb +0 -3
  138. data/lib/chef/provider/package/paludis.rb +0 -5
  139. data/lib/chef/provider/package/portage.rb +0 -2
  140. data/lib/chef/provider/package/rpm.rb +2 -4
  141. data/lib/chef/provider/package/rubygems.rb +0 -4
  142. data/lib/chef/provider/package/smartos.rb +0 -3
  143. data/lib/chef/provider/package/windows/msi.rb +0 -2
  144. data/lib/chef/provider/package/yum.rb +0 -4
  145. data/lib/chef/provider/package/zypper.rb +0 -3
  146. data/lib/chef/provider/registry_key.rb +0 -2
  147. data/lib/chef/provider/remote_directory.rb +0 -1
  148. data/lib/chef/provider/remote_file.rb +0 -1
  149. data/lib/chef/provider/remote_file/cache_control_data.rb +1 -3
  150. data/lib/chef/provider/remote_file/content.rb +0 -1
  151. data/lib/chef/provider/remote_file/fetcher.rb +0 -2
  152. data/lib/chef/provider/remote_file/ftp.rb +0 -1
  153. data/lib/chef/provider/resource_update.rb +0 -3
  154. data/lib/chef/provider/service/freebsd.rb +0 -3
  155. data/lib/chef/provider/service/init.rb +0 -3
  156. data/lib/chef/provider/service/macosx.rb +0 -1
  157. data/lib/chef/provider/service/redhat.rb +0 -2
  158. data/lib/chef/provider/service/simple.rb +0 -3
  159. data/lib/chef/provider/service/solaris.rb +0 -3
  160. data/lib/chef/provider/service/systemd.rb +15 -14
  161. data/lib/chef/provider/service/windows.rb +0 -3
  162. data/lib/chef/provider/subversion.rb +0 -2
  163. data/lib/chef/provider/template.rb +0 -2
  164. data/lib/chef/provider/template/content.rb +0 -1
  165. data/lib/chef/provider/user/dscl.rb +156 -549
  166. data/lib/chef/provider/user/solaris.rb +0 -1
  167. data/lib/chef/provider/user/useradd.rb +0 -3
  168. data/lib/chef/provider/whyrun_safe_ruby_block.rb +1 -1
  169. data/lib/chef/providers.rb +0 -1
  170. data/lib/chef/resource.rb +1 -4
  171. data/lib/chef/resource/freebsd_package.rb +2 -10
  172. data/lib/chef/resource/lwrp_base.rb +1 -12
  173. data/lib/chef/resource/user.rb +0 -18
  174. data/lib/chef/resource_collection.rb +1 -1
  175. data/lib/chef/resource_reporter.rb +10 -10
  176. data/lib/chef/resources.rb +0 -1
  177. data/lib/chef/role.rb +3 -3
  178. data/lib/chef/run_list.rb +1 -1
  179. data/lib/chef/tasks/chef_repo.rake +131 -264
  180. data/lib/chef/user.rb +1 -1
  181. data/lib/chef/util/path_helper.rb +2 -2
  182. data/lib/chef/version.rb +9 -1
  183. data/lib/chef/win32/api/system.rb +0 -9
  184. data/spec/data/bootstrap/test-hints.erb +1 -1
  185. data/spec/data/bootstrap/test.erb +1 -1
  186. data/spec/functional/dsl/reboot_pending_spec.rb +53 -58
  187. data/spec/functional/knife/cookbook_delete_spec.rb +3 -3
  188. data/spec/functional/knife/exec_spec.rb +1 -1
  189. data/spec/functional/mixin/shell_out_spec.rb +48 -0
  190. data/spec/functional/resource/base.rb +0 -10
  191. data/spec/functional/resource/group_spec.rb +1 -5
  192. data/spec/functional/resource/link_spec.rb +8 -0
  193. data/spec/functional/resource/{user/useradd_spec.rb → user_spec.rb} +1 -1
  194. data/spec/integration/knife/chef_fs_data_store_spec.rb +3 -3
  195. data/spec/integration/knife/chef_repo_path_spec.rb +1 -6
  196. data/spec/integration/knife/chef_repository_file_system_spec.rb +1 -1
  197. data/spec/integration/knife/chefignore_spec.rb +1 -1
  198. data/spec/integration/knife/common_options_spec.rb +50 -3
  199. data/spec/integration/knife/cookbook_api_ipv6_spec.rb +1 -1
  200. data/spec/integration/knife/delete_spec.rb +1 -1
  201. data/spec/integration/knife/deps_spec.rb +1 -1
  202. data/spec/integration/knife/diff_spec.rb +3 -3
  203. data/spec/integration/knife/download_spec.rb +3 -3
  204. data/spec/integration/knife/list_spec.rb +1 -1
  205. data/spec/integration/knife/raw_spec.rb +1 -11
  206. data/spec/integration/knife/redirection_spec.rb +1 -1
  207. data/spec/integration/knife/serve_spec.rb +2 -2
  208. data/spec/integration/knife/show_spec.rb +1 -1
  209. data/spec/integration/knife/upload_spec.rb +9 -9
  210. data/spec/spec_helper.rb +0 -9
  211. data/spec/support/pedant/pedant_config.rb +2 -1
  212. data/spec/support/pedant/run_pedant.rb +2 -1
  213. data/spec/support/platform_helpers.rb +5 -24
  214. data/spec/support/shared/integration/integration_helper.rb +2 -1
  215. data/spec/support/shared/matchers.rb +17 -0
  216. data/spec/tiny_server.rb +1 -2
  217. data/spec/unit/api_client_spec.rb +3 -3
  218. data/spec/unit/application_spec.rb +9 -32
  219. data/spec/unit/config_fetcher_spec.rb +1 -1
  220. data/spec/unit/cookbook/metadata_spec.rb +3 -7
  221. data/spec/unit/cookbook/synchronizer_spec.rb +441 -226
  222. data/spec/unit/cookbook_loader_spec.rb +1 -1
  223. data/spec/unit/cookbook_uploader_spec.rb +160 -0
  224. data/spec/unit/cookbook_version_spec.rb +0 -4
  225. data/spec/unit/data_bag_item_spec.rb +1 -5
  226. data/spec/unit/data_bag_spec.rb +1 -5
  227. data/spec/unit/deprecation_spec.rb +1 -1
  228. data/spec/unit/dsl/recipe_spec.rb +12 -0
  229. data/spec/unit/encrypted_data_bag_item_spec.rb +7 -14
  230. data/spec/unit/environment_spec.rb +3 -7
  231. data/spec/unit/exceptions_spec.rb +0 -6
  232. data/spec/unit/http/json_input_spec.rb +128 -0
  233. data/spec/unit/json_compat_spec.rb +17 -58
  234. data/spec/unit/knife/client_create_spec.rb +3 -3
  235. data/spec/unit/knife/configure_client_spec.rb +6 -5
  236. data/spec/unit/knife/cookbook_delete_spec.rb +1 -1
  237. data/spec/unit/knife/cookbook_download_spec.rb +5 -5
  238. data/spec/unit/knife/cookbook_metadata_from_file_spec.rb +1 -0
  239. data/spec/unit/knife/cookbook_metadata_spec.rb +1 -1
  240. data/spec/unit/knife/cookbook_site_download_spec.rb +10 -11
  241. data/spec/unit/knife/cookbook_site_install_spec.rb +116 -161
  242. data/spec/unit/knife/cookbook_site_share_spec.rb +8 -8
  243. data/spec/unit/knife/cookbook_upload_spec.rb +3 -2
  244. data/spec/unit/knife/core/bootstrap_context_spec.rb +3 -3
  245. data/spec/unit/knife/core/subcommand_loader_spec.rb +1 -66
  246. data/spec/unit/knife/data_bag_from_file_spec.rb +2 -1
  247. data/spec/unit/knife/tag_create_spec.rb +3 -3
  248. data/spec/unit/knife/tag_delete_spec.rb +3 -3
  249. data/spec/unit/knife/user_create_spec.rb +1 -1
  250. data/spec/unit/knife_spec.rb +14 -14
  251. data/spec/unit/lwrp_spec.rb +1 -21
  252. data/spec/unit/mixin/shell_out_spec.rb +92 -0
  253. data/spec/unit/node_spec.rb +0 -4
  254. data/spec/unit/platform/query_helpers_spec.rb +0 -23
  255. data/spec/unit/provider/env/windows_spec.rb +34 -70
  256. data/spec/unit/provider/env_spec.rb +11 -76
  257. data/spec/unit/provider/group/dscl_spec.rb +1 -38
  258. data/spec/unit/provider/log_spec.rb +18 -0
  259. data/spec/unit/provider/package/rpm_spec.rb +0 -12
  260. data/spec/unit/provider/remote_file/cache_control_data_spec.rb +1 -1
  261. data/spec/unit/provider/service/systemd_service_spec.rb +44 -27
  262. data/spec/unit/provider/user/dscl_spec.rb +264 -660
  263. data/spec/unit/provider/user/useradd_spec.rb +0 -1
  264. data/spec/unit/provider/whyrun_safe_ruby_block_spec.rb +2 -2
  265. data/spec/unit/provider_spec.rb +12 -0
  266. data/spec/unit/recipe_spec.rb +0 -41
  267. data/spec/unit/resource_collection_spec.rb +1 -5
  268. data/spec/unit/resource_reporter_spec.rb +3 -51
  269. data/spec/unit/resource_spec.rb +3 -14
  270. data/spec/unit/rest_spec.rb +1 -4
  271. data/spec/unit/role_spec.rb +0 -10
  272. data/spec/unit/run_list_spec.rb +1 -5
  273. data/spec/unit/user_spec.rb +1 -5
  274. metadata +20 -100
  275. data/lib/chef/mixin/windows_env_helper.rb +0 -56
  276. data/lib/chef/provider/dsc_script.rb +0 -175
  277. data/lib/chef/resource/dsc_script.rb +0 -126
  278. data/lib/chef/streaming_cookbook_uploader.rb +0 -205
  279. data/lib/chef/util/dsc/configuration_generator.rb +0 -115
  280. data/lib/chef/util/dsc/lcm_output_parser.rb +0 -133
  281. data/lib/chef/util/dsc/local_configuration_manager.rb +0 -141
  282. data/lib/chef/util/dsc/resource_info.rb +0 -26
  283. data/lib/chef/util/powershell/cmdlet.rb +0 -136
  284. data/lib/chef/util/powershell/cmdlet_result.rb +0 -46
  285. data/spec/data/mac_users/10.7-8.plist.xml +0 -559
  286. data/spec/data/mac_users/10.7-8.shadow.xml +0 -11
  287. data/spec/data/mac_users/10.7.plist.xml +0 -559
  288. data/spec/data/mac_users/10.7.shadow.xml +0 -11
  289. data/spec/data/mac_users/10.8.plist.xml +0 -559
  290. data/spec/data/mac_users/10.8.shadow.xml +0 -21
  291. data/spec/data/mac_users/10.9.plist.xml +0 -560
  292. data/spec/data/mac_users/10.9.shadow.xml +0 -21
  293. data/spec/functional/provider/whyrun_safe_ruby_block_spec.rb +0 -51
  294. data/spec/functional/resource/dsc_script_spec.rb +0 -382
  295. data/spec/functional/resource/env_spec.rb +0 -182
  296. data/spec/functional/resource/user/dscl_spec.rb +0 -199
  297. data/spec/functional/util/powershell/cmdlet_spec.rb +0 -113
  298. data/spec/support/lib/chef/resource/zen_follower.rb +0 -46
  299. data/spec/support/shared/shared_examples.rb +0 -10
  300. data/spec/unit/chef_fs/data_handler/group_handler_spec.rb +0 -63
  301. data/spec/unit/formatters/base_spec.rb +0 -48
  302. data/spec/unit/provider/dsc_script_spec.rb +0 -174
  303. data/spec/unit/resource/dsc_script_spec.rb +0 -98
  304. data/spec/unit/util/dsc/configuration_generator_spec.rb +0 -171
  305. data/spec/unit/util/dsc/lcm_output_parser_spec.rb +0 -169
  306. data/spec/unit/util/dsc/local_configuration_manager_spec.rb +0 -139
  307. data/spec/unit/util/powershell/cmdlet_spec.rb +0 -106
@@ -57,7 +57,7 @@ mkdir -p /etc/chef/ohai/hints
57
57
 
58
58
  <% @chef_config[:knife][:hints].each do |name, hash| -%>
59
59
  cat > /etc/chef/ohai/hints/<%= name %>.json <<'EOP'
60
- <%= Chef::JSONCompat.to_json(hash) %>
60
+ <%= hash.to_json %>
61
61
  EOP
62
62
  <% end -%>
63
63
  <% end -%>
@@ -67,7 +67,7 @@ cat > /etc/chef/client.rb <<'EOP'
67
67
  EOP
68
68
 
69
69
  cat > /etc/chef/first-boot.json <<'EOP'
70
- <%= Chef::JSONCompat.to_json(first_boot) %>
70
+ <%= first_boot.to_json %>
71
71
  EOP
72
72
 
73
73
  echo "Starting first Chef Client run..."
@@ -28,7 +28,7 @@ mkdir -p /etc/chef/ohai/hints
28
28
 
29
29
  <% @chef_config[:knife][:hints].each do |name, hash| -%>
30
30
  cat > /etc/chef/ohai/hints/<%= name %>.json <<'EOP'
31
- <%= Chef::JSONCompat.to_json(hash) %>
31
+ <%= hash.to_json %>
32
32
  EOP
33
33
  <% end -%>
34
34
  <% end -%>
@@ -38,7 +38,7 @@ cat > /etc/chef/client.rb <<'EOP'
38
38
  EOP
39
39
 
40
40
  cat > /etc/chef/first-boot.json <<'EOP'
41
- <%= Chef::JSONCompat.to_json(first_boot) %>
41
+ <%= first_boot.to_json %>
42
42
  EOP
43
43
 
44
44
  <%= start_chef %>'
@@ -28,7 +28,7 @@ mkdir -p /etc/chef/ohai/hints
28
28
 
29
29
  <% @chef_config[:knife][:hints].each do |name, hash| -%>
30
30
  cat > /etc/chef/ohai/hints/<%= name %>.json <<'EOP'
31
- <%= Chef::JSONCompat.to_json(hash) %>
31
+ <%= hash.to_json %>
32
32
  EOP
33
33
  <% end -%>
34
34
  <% end -%>
@@ -47,7 +47,7 @@ echo 'https_proxy "knife_config[:bootstrap_proxy]"' >> /etc/chef/client.rb
47
47
  <% end -%>
48
48
 
49
49
  cat > /etc/chef/first-boot.json <<'EOP'
50
- <%= Chef::JSONCompat.to_json(first_boot) %>
50
+ <%= first_boot.to_json %>
51
51
  EOP
52
52
 
53
53
  <%= start_chef %>'
@@ -32,7 +32,7 @@ mkdir -p /etc/chef/ohai/hints
32
32
 
33
33
  <% @chef_config[:knife][:hints].each do |name, hash| -%>
34
34
  cat > /etc/chef/ohai/hints/<%= name %>.json <<'EOP'
35
- <%= Chef::JSONCompat.to_json(hash) %>
35
+ <%= hash.to_json %>
36
36
  EOP
37
37
  <% end -%>
38
38
  <% end -%>
@@ -42,7 +42,7 @@ cat > /etc/chef/client.rb <<'EOP'
42
42
  EOP
43
43
 
44
44
  cat > /etc/chef/first-boot.json <<'EOP'
45
- <%= Chef::JSONCompat.to_json(first_boot) %>
45
+ <%= first_boot.to_json %>
46
46
  EOP
47
47
 
48
48
  <%= start_chef %>'
@@ -30,7 +30,7 @@ mkdir -p /etc/chef/ohai/hints
30
30
 
31
31
  <% @chef_config[:knife][:hints].each do |name, hash| -%>
32
32
  cat > /etc/chef/ohai/hints/<%= name %>.json <<'EOP'
33
- <%= Chef::JSONCompat.to_json(hash) %>
33
+ <%= hash.to_json %>
34
34
  EOP
35
35
  <% end -%>
36
36
  <% end -%>
@@ -40,7 +40,7 @@ cat > /etc/chef/client.rb <<'EOP'
40
40
  EOP
41
41
 
42
42
  cat > /etc/chef/first-boot.json <<'EOP'
43
- <%= Chef::JSONCompat.to_json(first_boot) %>
43
+ <%= first_boot.to_json %>
44
44
  EOP
45
45
 
46
46
  <%= start_chef %>'
@@ -58,7 +58,7 @@ class Chef
58
58
 
59
59
  private
60
60
  def cookbooks_api_url
61
- 'https://supermarket.getchef.com/api/v1/cookbooks'
61
+ 'http://cookbooks.opscode.com/api/v1/cookbooks'
62
62
  end
63
63
 
64
64
  def current_cookbook_data
@@ -17,11 +17,11 @@
17
17
  #
18
18
 
19
19
  require 'chef/knife'
20
- require 'chef/exceptions'
21
20
  require 'shellwords'
22
21
 
23
22
  class Chef
24
23
  class Knife
24
+
25
25
  class CookbookSiteInstall < Knife
26
26
 
27
27
  deps do
@@ -107,8 +107,11 @@ class Chef
107
107
  end
108
108
  end
109
109
 
110
+
110
111
  unless config[:no_deps]
111
- preferred_metadata.dependencies.each do |cookbook, version_list|
112
+ md = Chef::Cookbook::Metadata.new
113
+ md.from_file(File.join(@install_path, @cookbook_name, "metadata.rb"))
114
+ md.dependencies.each do |cookbook, version_list|
112
115
  # Doesn't do versions.. yet
113
116
  nv = self.class.new
114
117
  nv.config = config
@@ -141,7 +144,6 @@ class Chef
141
144
 
142
145
  def extract_cookbook(upstream_file, version)
143
146
  ui.info("Uncompressing #{@cookbook_name} version #{version}.")
144
- # FIXME: Detect if we have the bad tar from git on Windows: https://github.com/opscode/chef/issues/1753
145
147
  shell_out!("tar zxvf #{convert_path upstream_file}", :cwd => @install_path)
146
148
  end
147
149
 
@@ -151,37 +153,11 @@ class Chef
151
153
  end
152
154
 
153
155
  def convert_path(upstream_file)
154
- # converts a Windows path (C:\foo) to a mingw path (/c/foo)
155
- if ENV['MSYSTEM'] == 'MINGW32'
156
- return upstream_file.sub(/^([[:alpha:]]):/, '/\1')
157
- else
158
- return Shellwords.escape upstream_file
159
- end
160
- end
161
-
162
- # Get the preferred metadata path on disk. Chef prefers the metadata.rb
163
- # over the metadata.json.
164
- #
165
- # @raise if there is no metadata in the cookbook
166
- #
167
- # @return [Chef::Cookbook::Metadata]
168
- def preferred_metadata
169
- md = Chef::Cookbook::Metadata.new
170
-
171
- rb = File.join(@install_path, @cookbook_name, "metadata.rb")
172
- if File.exist?(rb)
173
- md.from_file(rb)
174
- return md
175
- end
176
-
177
- json = File.join(@install_path, @cookbook_name, "metadata.json")
178
- if File.exist?(json)
179
- json = IO.read(json)
180
- md.from_json(json)
181
- return md
182
- end
183
-
184
- raise Chef::Exceptions::MetadataNotFound.new(@install_path, @cookbook_name)
156
+ if ENV['MSYSTEM'] == 'MINGW32'
157
+ return upstream_file.sub(/^([[:alpha:]]):/, '/\1')
158
+ else
159
+ return Shellwords.escape upstream_file
160
+ end
185
161
  end
186
162
  end
187
163
  end
@@ -41,7 +41,7 @@ class Chef
41
41
  end
42
42
 
43
43
  def get_cookbook_list(items=10, start=0, cookbook_collection={})
44
- cookbooks_url = "https://supermarket.getchef.com/api/v1/cookbooks?items=#{items}&start=#{start}"
44
+ cookbooks_url = "http://cookbooks.opscode.com/api/v1/cookbooks?items=#{items}&start=#{start}"
45
45
  cr = noauth_rest.get_rest(cookbooks_url)
46
46
  cr["items"].each do |cookbook|
47
47
  cookbook_collection[cookbook["cookbook_name"]] = cookbook
@@ -29,7 +29,7 @@ class Chef
29
29
  end
30
30
 
31
31
  def search_cookbook(query, items=10, start=0, cookbook_collection={})
32
- cookbooks_url = "https://supermarket.getchef.com/api/v1/search?q=#{query}&items=#{items}&start=#{start}"
32
+ cookbooks_url = "http://cookbooks.opscode.com/api/v1/search?q=#{query}&items=#{items}&start=#{start}"
33
33
  cr = noauth_rest.get_rest(cookbooks_url)
34
34
  cr["items"].each do |cookbook|
35
35
  cookbook_collection[cookbook["cookbook_name"]] = cookbook
@@ -54,7 +54,7 @@ class Chef
54
54
  cl = Chef::CookbookLoader.new(config[:cookbook_path])
55
55
  if cl.cookbook_exists?(cookbook_name)
56
56
  cookbook = cl[cookbook_name]
57
- Chef::CookbookUploader.new(cookbook,config[:cookbook_path]).validate_cookbooks
57
+ Chef::CookbookUploader.new(cookbook).validate_cookbooks
58
58
  tmp_cookbook_dir = Chef::CookbookSiteStreamingUploader.create_build_dir(cookbook)
59
59
  begin
60
60
  Chef::Log.debug("Temp cookbook directory is #{tmp_cookbook_dir.inspect}")
@@ -85,9 +85,9 @@ class Chef
85
85
  end
86
86
 
87
87
  def do_upload(cookbook_filename, cookbook_category, user_id, user_secret_filename)
88
- uri = "https://supermarket.getchef.com/api/v1/cookbooks"
88
+ uri = "http://cookbooks.opscode.com/api/v1/cookbooks"
89
89
 
90
- category_string = Chef::JSONCompat.to_json({ 'category'=>cookbook_category })
90
+ category_string = { 'category'=>cookbook_category }.to_json
91
91
 
92
92
  http_resp = Chef::CookbookSiteStreamingUploader.post(uri, user_id, user_secret_filename, {
93
93
  :tarball => File.open(cookbook_filename),
@@ -31,14 +31,14 @@ class Chef
31
31
  def get_cookbook_data
32
32
  case @name_args.length
33
33
  when 1
34
- noauth_rest.get_rest("https://supermarket.getchef.com/api/v1/cookbooks/#{@name_args[0]}")
34
+ noauth_rest.get_rest("http://cookbooks.opscode.com/api/v1/cookbooks/#{@name_args[0]}")
35
35
  when 2
36
- noauth_rest.get_rest("https://supermarket.getchef.com/api/v1/cookbooks/#{@name_args[0]}/versions/#{name_args[1].gsub('.', '_')}")
36
+ noauth_rest.get_rest("http://cookbooks.opscode.com/api/v1/cookbooks/#{@name_args[0]}/versions/#{name_args[1].gsub('.', '_')}")
37
37
  end
38
38
  end
39
39
 
40
40
  def get_cookbook_list(items=10, start=0, cookbook_collection={})
41
- cookbooks_url = "https://supermarket.getchef.com/api/v1/cookbooks?items=#{items}&start=#{start}"
41
+ cookbooks_url = "http://cookbooks.opscode.com/api/v1/cookbooks?items=#{items}&start=#{start}"
42
42
  cr = noauth_rest.get_rest(cookbooks_url)
43
43
  cr["items"].each do |cookbook|
44
44
  cookbook_collection[cookbook["cookbook_name"]] = cookbook
@@ -41,7 +41,7 @@ class Chef
41
41
  confirm "Do you really want to unshare the cookbook #{@cookbook_name}"
42
42
 
43
43
  begin
44
- rest.delete_rest "https://supermarket.getchef.com/api/v1/cookbooks/#{@name_args[0]}"
44
+ rest.delete_rest "http://cookbooks.opscode.com/api/v1/cookbooks/#{@name_args[0]}"
45
45
  rescue Net::HTTPServerException => e
46
46
  raise e unless e.message =~ /Forbidden/
47
47
  ui.error "Forbidden: You must be the maintainer of #{@cookbook_name} to unshare it."
@@ -240,7 +240,7 @@ WARNING
240
240
  check_for_broken_links!(cb)
241
241
  check_for_dependencies!(cb)
242
242
  end
243
- Chef::CookbookUploader.new(cookbooks, config[:cookbook_path], :force => config[:force], :concurrency => config[:concurrency]).upload_cookbooks
243
+ Chef::CookbookUploader.new(cookbooks, :force => config[:force], :concurrency => config[:concurrency]).upload_cookbooks
244
244
  rescue Chef::Exceptions::CookbookFrozen => e
245
245
  ui.error e
246
246
  raise
@@ -21,9 +21,6 @@ class Chef
21
21
  class Knife
22
22
  class SubcommandLoader
23
23
 
24
- MATCHES_CHEF_GEM = %r{/chef-[\d]+\.[\d]+\.[\d]+}.freeze
25
- MATCHES_THIS_CHEF_GEM = %r{/chef-#{Chef::VERSION}/}.freeze
26
-
27
24
  attr_reader :chef_config_dir
28
25
  attr_reader :env
29
26
 
@@ -124,14 +121,6 @@ class Chef
124
121
  subcommand_files = {}
125
122
  files.each do |file|
126
123
  rel_path = file[/(#{Regexp.escape File.join('chef', 'knife', '')}.*)\.rb/, 1]
127
-
128
- # When not installed as a gem (ChefDK/appbundler in particular), AND
129
- # a different version of Chef is installed via gems, `files` will
130
- # include some files from the 'other' Chef install. If this contains
131
- # a knife command that doesn't exist in this version of Chef, we will
132
- # get a LoadError later when we try to require it.
133
- next if from_different_chef_version?(file)
134
-
135
124
  subcommand_files[rel_path] = file
136
125
  end
137
126
 
@@ -195,19 +184,6 @@ class Chef
195
184
 
196
185
  Dir[glob].map { |f| f.untaint }
197
186
  end
198
-
199
- def from_different_chef_version?(path)
200
- matches_any_chef_gem?(path) && !matches_this_chef_gem?(path)
201
- end
202
-
203
- def matches_any_chef_gem?(path)
204
- path =~ MATCHES_CHEF_GEM
205
- end
206
-
207
- def matches_this_chef_gem?(path)
208
- path =~ MATCHES_THIS_CHEF_GEM
209
- end
210
-
211
187
  end
212
188
  end
213
189
  end
@@ -73,10 +73,8 @@ class Chef
73
73
  end
74
74
  end
75
75
 
76
- alias :info :msg
77
-
78
- # Prints a msg to stderr. Used for warn, error, and fatal.
79
- def err(message)
76
+ # Prints a msg to stderr. Used for info, warn, error, and fatal.
77
+ def log(message)
80
78
  begin
81
79
  stderr.puts message
82
80
  rescue Errno::EPIPE => e
@@ -85,19 +83,22 @@ class Chef
85
83
  end
86
84
  end
87
85
 
86
+ alias :info :log
87
+ alias :err :log
88
+
88
89
  # Print a warning message
89
90
  def warn(message)
90
- err("#{color('WARNING:', :yellow, :bold)} #{message}")
91
+ log("#{color('WARNING:', :yellow, :bold)} #{message}")
91
92
  end
92
93
 
93
94
  # Print an error message
94
95
  def error(message)
95
- err("#{color('ERROR:', :red, :bold)} #{message}")
96
+ log("#{color('ERROR:', :red, :bold)} #{message}")
96
97
  end
97
98
 
98
99
  # Print a message describing a fatal error.
99
100
  def fatal(message)
100
- err("#{color('FATAL:', :red, :bold)} #{message}")
101
+ log("#{color('FATAL:', :red, :bold)} #{message}")
101
102
  end
102
103
 
103
104
  def color(string, *colors)
@@ -9,7 +9,6 @@ class Chef
9
9
 
10
10
  deps do
11
11
  require 'chef/chef_fs/file_system'
12
- require 'chef/json_compat'
13
12
  require 'chef/run_list'
14
13
  end
15
14
 
@@ -78,7 +77,7 @@ class Chef
78
77
  return entry.chef_object.metadata.dependencies.keys.map { |cookbook| "/cookbooks/#{cookbook}" }
79
78
 
80
79
  elsif entry.parent && entry.parent.path == '/nodes'
81
- node = Chef::JSONCompat.parse(entry.read, :create_additions => false)
80
+ node = JSON.parse(entry.read, :create_additions => false)
82
81
  result = []
83
82
  if node['chef_environment'] && node['chef_environment'] != '_default'
84
83
  result << "/environments/#{node['chef_environment']}.json"
@@ -89,7 +88,7 @@ class Chef
89
88
  result
90
89
 
91
90
  elsif entry.parent && entry.parent.path == '/roles'
92
- role = Chef::JSONCompat.parse(entry.read, :create_additions => false)
91
+ role = JSON.parse(entry.read, :create_additions => false)
93
92
  result = []
94
93
  if role['run_list']
95
94
  dependencies_from_runlist(role['run_list']).each do |dependency|
@@ -1,4 +1,5 @@
1
1
  require 'chef/knife'
2
+ require 'chef/local_mode'
2
3
 
3
4
  class Chef
4
5
  class Knife
@@ -30,8 +31,8 @@ class Chef
30
31
  end
31
32
 
32
33
  def run
34
+ server = Chef::LocalMode.chef_zero_server
33
35
  begin
34
- server = Chef::Application.chef_zero_server
35
36
  output "Serving files from:\n#{server.options[:data_store].chef_fs.fs_description}"
36
37
  server.stop
37
38
  server.start(stdout) # to print header
@@ -0,0 +1,105 @@
1
+ #
2
+ # Author:: John Keiser (<jkeiser@getchef.com>)
3
+ # Copyright:: Copyright (c) 2013 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ require 'chef/config'
18
+
19
+ class Chef
20
+ module LocalMode
21
+ # Create a chef local server (if the configuration requires one) for the
22
+ # duration of the given block.
23
+ #
24
+ # # This ...
25
+ # with_server_connectivity { stuff }
26
+ #
27
+ # # Is exactly equivalent to this ...
28
+ # Chef::LocalMode.setup_server_connectivity
29
+ # begin
30
+ # stuff
31
+ # ensure
32
+ # Chef::LocalMode.destroy_server_connectivity
33
+ # end
34
+ #
35
+ def self.with_server_connectivity
36
+ setup_server_connectivity
37
+ begin
38
+ yield
39
+ ensure
40
+ destroy_server_connectivity
41
+ end
42
+ end
43
+
44
+ # If Chef::Config.chef_zero.enabled is true, sets up a chef-zero server
45
+ # according to the Chef::Config.chef_zero and path options, and sets
46
+ # chef_server_url to point at it.
47
+ def self.setup_server_connectivity
48
+ if Chef::Config.chef_zero.enabled
49
+ destroy_server_connectivity
50
+
51
+ require 'chef_zero/server'
52
+ require 'chef/chef_fs/chef_fs_data_store'
53
+ require 'chef/chef_fs/config'
54
+
55
+ chef_fs = Chef::ChefFS::Config.new.local_fs
56
+ chef_fs.write_pretty_json = true
57
+ data_store = Chef::ChefFS::ChefFSDataStore.new(chef_fs)
58
+ server_options = {}
59
+ server_options[:data_store] = data_store
60
+ server_options[:log_level] = Chef::Log.level
61
+ server_options[:host] = Chef::Config.chef_zero.host
62
+ server_options[:port] = parse_port(Chef::Config.chef_zero.port)
63
+ @chef_zero_server = ChefZero::Server.new(server_options)
64
+ @chef_zero_server.start_background
65
+ Chef::Log.info("Started chef-zero at #{@chef_zero_server.url} with #{chef_fs.fs_description}")
66
+ Chef::Config.chef_server_url = @chef_zero_server.url
67
+ end
68
+ end
69
+
70
+ # Return the current chef-zero server set up by setup_server_connectivity.
71
+ def self.chef_zero_server
72
+ @chef_zero_server
73
+ end
74
+
75
+ # If chef_zero_server is non-nil, stop it and remove references to it.
76
+ def self.destroy_server_connectivity
77
+ if @chef_zero_server
78
+ @chef_zero_server.stop
79
+ @chef_zero_server = nil
80
+ end
81
+ end
82
+
83
+ def self.parse_port(port)
84
+ if port.is_a?(String)
85
+ parts = port.split(',')
86
+ if parts.size == 1
87
+ a,b = parts[0].split('-',2)
88
+ if b
89
+ a.to_i.upto(b.to_i)
90
+ else
91
+ [ a.to_i ]
92
+ end
93
+ else
94
+ array = []
95
+ parts.each do |part|
96
+ array += parse_port(part).to_a
97
+ end
98
+ array
99
+ end
100
+ else
101
+ port
102
+ end
103
+ end
104
+ end
105
+ end