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

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -73,7 +73,7 @@ class Chef
73
73
  end
74
74
 
75
75
  def to_json(*a)
76
- Chef::JSONCompat.to_json(to_hash, *a)
76
+ to_hash.to_json(*a)
77
77
  end
78
78
 
79
79
  def destroy
@@ -32,7 +32,7 @@ class Chef
32
32
  Chef::Log.error(msg)
33
33
  raise Chef::Exceptions::ValidationFailed, msg
34
34
  end
35
-
35
+
36
36
  if windows_max_length_exceeded?(path)
37
37
  Chef::Log.debug("Path '#{path}' is longer than #{WIN_MAX_PATH}, prefixing with'\\\\?\\'")
38
38
  path.insert(0, "\\\\?\\")
@@ -50,7 +50,7 @@ class Chef
50
50
  return true
51
51
  end
52
52
  end
53
-
53
+
54
54
  false
55
55
  end
56
56
 
@@ -1,3 +1,4 @@
1
+
1
2
  # Author:: Daniel DeLeo (<dan@opscode.com>)
2
3
  # Copyright:: Copyright (c) 2010-2011 Opscode, Inc.
3
4
  # License:: Apache License, Version 2.0
@@ -16,7 +17,14 @@
16
17
 
17
18
  class Chef
18
19
  CHEF_ROOT = File.dirname(File.expand_path(File.dirname(__FILE__)))
19
- VERSION = '11.18.12'
20
+ VERSION = '12.0.0.alpha.0'
20
21
  end
21
22
 
23
+ #
22
24
  # NOTE: the Chef::Version class is defined in version_class.rb
25
+ #
26
+ # NOTE: DO NOT Use the Chef::Version class on Chef::VERSIONs. The
27
+ # Chef::Version class is for _cookbooks_ only, and cannot handle
28
+ # pre-release chef-client versions like "10.14.0.rc.2". Please
29
+ # use Rubygem's Gem::Version class instead.
30
+ #
@@ -200,15 +200,6 @@ LRESULT WINAPI SendMessageTimeout(
200
200
  safe_attach_function :SendMessageTimeoutW, [:HWND, :UINT, :WPARAM, :LPARAM, :UINT, :UINT, :PDWORD_PTR], :LRESULT
201
201
  safe_attach_function :SendMessageTimeoutA, [:HWND, :UINT, :WPARAM, :LPARAM, :UINT, :UINT, :PDWORD_PTR], :LRESULT
202
202
 
203
- =begin
204
- DWORD WINAPI ExpandEnvironmentStrings(
205
- _In_ LPCTSTR lpSrc,
206
- _Out_opt_ LPTSTR lpDst,
207
- _In_ DWORD nSize
208
- );
209
- =end
210
- safe_attach_function :ExpandEnvironmentStringsW, [:pointer, :pointer, :DWORD], :DWORD
211
- safe_attach_function :ExpandEnvironmentStringsA, [:pointer, :pointer, :DWORD], :DWORD
212
203
  end
213
204
  end
214
205
  end
@@ -6,7 +6,7 @@ mkdir -p /etc/chef/ohai/hints
6
6
  <% @chef_config[:knife][:hints].each do |name, hash| -%>
7
7
  (
8
8
  cat <<'EOP'
9
- <%= Chef::JSONCompat.to_json(hash) %>
9
+ <%= hash.to_json %>
10
10
  EOP
11
11
  ) > /etc/chef/ohai/hints/<%= name %>.json
12
12
  <% end -%>
@@ -1 +1 @@
1
- <%= Chef::JSONCompat.to_json(first_boot) %>
1
+ <%= first_boot.to_json %>
@@ -30,11 +30,11 @@ describe Chef::DSL::RebootPending, :windows_only do
30
30
  ohai
31
31
  end
32
32
 
33
- def registry_unsafe?
34
- registry.value_exists?('HKLM\SYSTEM\CurrentControlSet\Control\Session Manager', { :name => 'PendingFileRenameOperations' }) ||
35
- registry.key_exists?('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired')
36
- registry.key_exists?('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootRequired') ||
37
- registry.key_exists?('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile')
33
+ def registry_safe?
34
+ !registry.value_exists?('HKLM\SYSTEM\CurrentControlSet\Control\Session Manager', { :name => 'PendingFileRenameOperations' }) ||
35
+ !registry.key_exists?('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired') ||
36
+ !registry.key_exists?('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootRequired') ||
37
+ !registry.key_exists?('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile')
38
38
  end
39
39
 
40
40
  let(:node) { Chef::Node.new }
@@ -44,78 +44,73 @@ describe Chef::DSL::RebootPending, :windows_only do
44
44
  let(:recipe) { Chef::Recipe.new("a windows cookbook", "the windows recipe", run_context) }
45
45
  let(:registry) { Chef::Win32::Registry.new(run_context) }
46
46
 
47
- pending "Can't safely test Registry entries" do
48
- describe "reboot_pending?" do
47
+ describe "reboot_pending?" do
49
48
 
50
- describe "when there is nothing to indicate a reboot is pending" do
51
- it "should return false" do
52
- pending "Found existing registry keys" if registry_unsafe?
53
- expect(recipe.reboot_pending?).to be_false
54
- end
55
- end
49
+ context "when there is nothing to indicate a reboot is pending" do
50
+ it { expect(recipe.reboot_pending?).to be_false }
51
+ end
56
52
 
57
- describe 'HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations' do
58
- it "returns true if the registry value exists" do
59
- pending "Found existing registry keys" if registry_unsafe?
60
- registry.set_value('HKLM\SYSTEM\CurrentControlSet\Control\Session Manager',
61
- { :name => 'PendingFileRenameOperations', :type => :multi_string, :data => ['\??\C:\foo.txt|\??\C:\bar.txt'] })
53
+ describe 'HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations' do
54
+ it "returns true if the registry value exists" do
55
+ pending "Found existing registry keys" unless registry_safe?
56
+ registry.set_value('HKLM\SYSTEM\CurrentControlSet\Control\Session Manager',
57
+ { :name => 'PendingFileRenameOperations', :type => :multi_string, :data => ['\??\C:\foo.txt|\??\C:\bar.txt'] })
62
58
 
63
- expect(recipe.reboot_pending?).to be_true
64
- end
59
+ expect(recipe.reboot_pending?).to be_true
60
+ end
65
61
 
66
- after do
67
- unless registry_unsafe?
68
- registry.delete_value('HKLM\SYSTEM\CurrentControlSet\Control\Session Manager', { :name => 'PendingFileRenameOperations' })
69
- end
62
+ after do
63
+ if registry_safe?
64
+ registry.delete_value('HKLM\SYSTEM\CurrentControlSet\Control\Session Manager', { :name => 'PendingFileRenameOperations' })
70
65
  end
71
66
  end
67
+ end
72
68
 
73
- describe 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired' do
74
- it "returns true if the registry key exists" do
75
- pending "Found existing registry keys" if registry_unsafe?
76
- registry.create_key('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired', false)
69
+ describe 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired' do
70
+ it "returns true if the registry key exists" do
71
+ pending "Found existing registry keys" unless registry_safe?
72
+ registry.create_key('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired', false)
77
73
 
78
- expect(recipe.reboot_pending?).to be_true
79
- end
74
+ expect(recipe.reboot_pending?).to be_true
75
+ end
80
76
 
81
- after do
82
- unless registry_unsafe?
83
- registry.delete_key('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired', false)
84
- end
77
+ after do
78
+ if registry_safe?
79
+ registry.delete_key('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired', false)
85
80
  end
86
81
  end
82
+ end
87
83
 
88
- describe 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootRequired' do
89
- it "returns true if the registry key exists" do
90
- pending "Permissions are limited to 'TrustedInstaller' by default"
91
- pending "Found existing registry keys" if registry_unsafe?
92
- registry.create_key('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootRequired', false)
84
+ describe 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootRequired' do
85
+ it "returns true if the registry key exists" do
86
+ pending "Permissions are limited to 'TrustedInstaller' by default"
87
+ pending "Found existing registry keys" unless registry_safe?
88
+ registry.create_key('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootRequired', false)
93
89
 
94
- expect(recipe.reboot_pending?).to be_true
95
- end
90
+ expect(recipe.reboot_pending?).to be_true
91
+ end
96
92
 
97
- after do
98
- unless registry_unsafe?
99
- registry.delete_key('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootRequired', false)
100
- end
93
+ after do
94
+ if registry_safe?
95
+ registry.delete_key('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootRequired', false)
101
96
  end
102
97
  end
98
+ end
103
99
 
104
- describe 'HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile\Flags' do
105
- it "returns true if the registry key exists" do
106
- pending "Found existing registry keys" if registry_unsafe?
107
- registry.create_key('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile', true)
108
- registry.set_value('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile',
109
- { :name => 'Flags', :type => :dword, :data => 3 })
100
+ describe 'HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile\Flags' do
101
+ it "returns true if the registry key exists" do
102
+ pending "Found existing registry keys" unless registry_safe?
103
+ registry.create_key('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile', true)
104
+ registry.set_value('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile',
105
+ { :name => 'Flags', :type => :dword, :data => 3 })
110
106
 
111
- expect(recipe.reboot_pending?).to be_true
112
- end
107
+ expect(recipe.reboot_pending?).to be_true
108
+ end
113
109
 
114
- after do
115
- unless registry_unsafe?
116
- registry.delete_value('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile', { :name => 'Flags' })
117
- registry.delete_key('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile', false)
118
- end
110
+ after do
111
+ if registry_safe?
112
+ registry.delete_value('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile', { :name => 'Flags' })
113
+ registry.delete_key('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile', false)
119
114
  end
120
115
  end
121
116
  end
@@ -47,7 +47,7 @@ describe Chef::Knife::CookbookDelete do
47
47
  Chef::Log.level = :debug
48
48
 
49
49
  @knife.name_args = %w{no-such-cookbook}
50
- @api.get("/cookbooks/no-such-cookbook", 404, Chef::JSONCompat.to_json({'error'=>'dear Tim, no. -Sent from my iPad'}))
50
+ @api.get("/cookbooks/no-such-cookbook", 404, {'error'=>'dear Tim, no. -Sent from my iPad'}.to_json)
51
51
  end
52
52
 
53
53
  it "logs an error and exits" do
@@ -62,7 +62,7 @@ describe Chef::Knife::CookbookDelete do
62
62
  before do
63
63
  @knife.name_args = %w{obsolete-cookbook}
64
64
  @cookbook_list = {'obsolete-cookbook' => { 'versions' => ['version' => '1.0.0']} }
65
- @api.get("/cookbooks/obsolete-cookbook", 200, Chef::JSONCompat.to_json(@cookbook_list))
65
+ @api.get("/cookbooks/obsolete-cookbook", 200, @cookbook_list.to_json)
66
66
  end
67
67
 
68
68
  it "asks for confirmation, then deletes the cookbook" do
@@ -105,7 +105,7 @@ describe Chef::Knife::CookbookDelete do
105
105
  versions = ['1.0.0', '1.1.0', '1.2.0']
106
106
  with_version = lambda { |version| { 'version' => version } }
107
107
  @cookbook_list = {'obsolete-cookbook' => { 'versions' => versions.map(&with_version) } }
108
- @api.get("/cookbooks/obsolete-cookbook", 200, Chef::JSONCompat.to_json(@cookbook_list))
108
+ @api.get("/cookbooks/obsolete-cookbook", 200, @cookbook_list.to_json)
109
109
  end
110
110
 
111
111
  it "deletes all versions of a cookbook when given the '-a' flag" do
@@ -47,7 +47,7 @@ describe Chef::Knife::Exec do
47
47
  @node = Chef::Node.new
48
48
  @node.name("ohai-world")
49
49
  response = {"rows" => [@node],"start" => 0,"total" => 1}
50
- @api.get(%r{^/search/node}, 200, Chef::JSONCompat.to_json(response))
50
+ @api.get(%r{^/search/node}, 200, response.to_json)
51
51
  code = "$output.puts nodes.all"
52
52
  @knife.config[:exec] = code
53
53
  @knife.run
@@ -0,0 +1,48 @@
1
+ #
2
+ # Copyright:: Copyright (c) 2014 Chef Software, Inc.
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ require 'spec_helper'
19
+
20
+ describe Chef::Mixin::ShellOut do
21
+ include Chef::Mixin::ShellOut
22
+
23
+ describe "shell_out_with_systems_locale" do
24
+ describe "when environment['LC_ALL'] is not set" do
25
+ it "should use the default shell_out setting" do
26
+ cmd = if windows?
27
+ shell_out_with_systems_locale('echo %LC_ALL%')
28
+ else
29
+ shell_out_with_systems_locale('echo $LC_ALL')
30
+ end
31
+
32
+ cmd.stdout.chomp.should match_environment_variable('LC_ALL')
33
+ end
34
+ end
35
+
36
+ describe "when environment['LC_ALL'] is set" do
37
+ it "should use the option's setting" do
38
+ cmd = if windows?
39
+ shell_out_with_systems_locale('echo %LC_ALL%', :environment => {'LC_ALL' => 'POSIX'})
40
+ else
41
+ shell_out_with_systems_locale('echo $LC_ALL', :environment => {'LC_ALL' => 'POSIX'})
42
+ end
43
+
44
+ cmd.stdout.chomp.should eq 'POSIX'
45
+ end
46
+ end
47
+ end
48
+ end
@@ -16,16 +16,6 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require 'spec_helper'
20
-
21
- def ohai
22
- # provider is platform-dependent, we need platform ohai data:
23
- @OHAI_SYSTEM ||= begin
24
- ohai = Ohai::System.new
25
- ohai.all_plugins("platform")
26
- ohai
27
- end
28
- end
29
19
 
30
20
  def run_context
31
21
  @run_context ||= begin
@@ -40,11 +40,6 @@ describe Chef::Resource::Group, :requires_root_or_running_windows, :not_supporte
40
40
  when "windows"
41
41
  user_sid = sid_string_from_user(user)
42
42
  user_sid.nil? ? false : Chef::Util::Windows::NetGroup.new(group_name).local_get_members.include?(user_sid)
43
- when "mac_os_x"
44
- membership_info = shell_out("dscl . -read /Groups/#{group_name}").stdout
45
- members = membership_info.split(" ")
46
- members.shift # Get rid of GroupMembership: string
47
- members.include?(user)
48
43
  else
49
44
  Etc::getgrnam(group_name).mem.include?(user)
50
45
  end
@@ -425,3 +420,4 @@ downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestreeQQQQQQ" }
425
420
  end
426
421
  end
427
422
  end
423
+
@@ -377,6 +377,14 @@ describe Chef::Resource::Link do
377
377
  include_context 'create symbolic link succeeds'
378
378
  include_context 'delete is noop'
379
379
  end
380
+ context 'and the link already exists and points to a different directory' do
381
+ before(:each) do
382
+ other_dir = File.join(test_file_dir, make_tmpname("other_dir"))
383
+ Dir.mkdir(other_dir)
384
+ symlink(other_dir, target_file)
385
+ end
386
+ include_context 'create symbolic link succeeds'
387
+ end
380
388
  end
381
389
  context "when the link destination is a symbolic link" do
382
390
  context 'to a file that exists' do
@@ -25,7 +25,7 @@ metadata = { :unix_only => true,
25
25
  :provider => {:user => Chef::Provider::User::Useradd}
26
26
  }
27
27
 
28
- describe Chef::Provider::User::Useradd, metadata do
28
+ describe Chef::Resource::User, metadata do
29
29
 
30
30
  include Chef::Mixin::ShellOut
31
31
 
@@ -22,7 +22,7 @@ require 'chef/knife/show'
22
22
  require 'chef/knife/raw'
23
23
  require 'chef/knife/cookbook_upload'
24
24
 
25
- describe 'ChefFSDataStore tests', :workstation do
25
+ describe 'ChefFSDataStore tests' do
26
26
  extend IntegrationSupport
27
27
  include KnifeSupport
28
28
 
@@ -141,7 +141,7 @@ EOM
141
141
  end
142
142
 
143
143
  it 'knife cookbook upload works' do
144
- knife("cookbook upload -z --cookbook-path #{path_to('cookbooks_to_upload')} x").should_succeed <<EOM
144
+ knife("cookbook upload -z --cookbook-path #{path_to('cookbooks_to_upload')} x").should_succeed :stderr => <<EOM
145
145
  Uploading x [1.0.0]
146
146
  Uploaded 1 cookbook.
147
147
  EOM
@@ -199,7 +199,7 @@ EOM
199
199
  end
200
200
 
201
201
  it 'knife cookbook upload works' do
202
- knife("cookbook upload -z --cookbook-path #{path_to('cookbooks_to_upload')} z").should_succeed <<EOM
202
+ knife("cookbook upload -z --cookbook-path #{path_to('cookbooks_to_upload')} z").should_succeed :stderr => <<EOM
203
203
  Uploading z [1.0.0]
204
204
  Uploaded 1 cookbook.
205
205
  EOM
@@ -20,7 +20,7 @@ require 'support/shared/context/config'
20
20
  require 'chef/knife/list'
21
21
  require 'chef/knife/show'
22
22
 
23
- describe 'chef_repo_path tests', :workstation do
23
+ describe 'chef_repo_path tests' do
24
24
  extend IntegrationSupport
25
25
  include KnifeSupport
26
26
 
@@ -287,7 +287,6 @@ EOM
287
287
  knife('show --local /clients/blah.json').should_succeed <<EOM
288
288
  /clients/blah.json:
289
289
  {
290
-
291
290
  }
292
291
  EOM
293
292
  end
@@ -375,7 +374,6 @@ EOM
375
374
  knife('show --local /environments/blah.json').should_succeed <<EOM
376
375
  /environments/blah.json:
377
376
  {
378
-
379
377
  }
380
378
  EOM
381
379
  end
@@ -388,7 +386,6 @@ EOM
388
386
  knife('show --local /nodes/blah.json').should_succeed <<EOM
389
387
  /nodes/blah.json:
390
388
  {
391
-
392
389
  }
393
390
  EOM
394
391
  end
@@ -401,7 +398,6 @@ EOM
401
398
  knife('show --local /roles/blah.json').should_succeed <<EOM
402
399
  /roles/blah.json:
403
400
  {
404
-
405
401
  }
406
402
  EOM
407
403
  end
@@ -414,7 +410,6 @@ EOM
414
410
  knife('show --local /users/blah.json').should_succeed <<EOM
415
411
  /users/blah.json:
416
412
  {
417
-
418
413
  }
419
414
  EOM
420
415
  end
@@ -19,7 +19,7 @@ require 'support/shared/integration/integration_helper'
19
19
  require 'chef/knife/list'
20
20
  require 'chef/knife/show'
21
21
 
22
- describe 'General chef_repo file system checks', :workstation do
22
+ describe 'General chef_repo file system checks' do
23
23
  extend IntegrationSupport
24
24
  include KnifeSupport
25
25