chef 12.13.37-universal-mingw32 → 12.14.60-universal-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 (338) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +48 -95
  3. data/Gemfile +6 -1
  4. data/README.md +9 -11
  5. data/VERSION +1 -1
  6. data/acceptance/.shared/kitchen_acceptance/.kitchen.ec2.yml +0 -1
  7. data/acceptance/Gemfile +4 -7
  8. data/acceptance/Gemfile.lock +59 -92
  9. data/acceptance/basics/test/integration/helpers/serverspec/Gemfile +8 -0
  10. data/acceptance/data-collector/test/integration/helpers/serverspec/Gemfile +8 -0
  11. data/acceptance/fips/test/integration/fips-integration/serverspec/Gemfile +6 -0
  12. data/acceptance/fips/test/integration/fips-unit-functional/serverspec/Gemfile +4 -0
  13. data/chef.gemspec +3 -2
  14. data/lib/chef/application/client.rb +4 -4
  15. data/lib/chef/application/solo.rb +2 -2
  16. data/lib/chef/chef_fs/command_line.rb +36 -34
  17. data/lib/chef/chef_fs/data_handler/data_handler_base.rb +2 -2
  18. data/lib/chef/chef_fs/file_pattern.rb +1 -1
  19. data/lib/chef/chef_fs/file_system.rb +139 -137
  20. data/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb +2 -6
  21. data/lib/chef/cookbook/cookbook_version_loader.rb +27 -22
  22. data/lib/chef/cookbook/metadata.rb +1 -1
  23. data/lib/chef/cookbook/synchronizer.rb +3 -3
  24. data/lib/chef/cookbook_site_streaming_uploader.rb +3 -3
  25. data/lib/chef/cookbook_uploader.rb +1 -1
  26. data/lib/chef/cookbook_version.rb +6 -6
  27. data/lib/chef/dsl/powershell.rb +1 -1
  28. data/lib/chef/event_dispatch/base.rb +2 -2
  29. data/lib/chef/exceptions.rb +1 -1
  30. data/lib/chef/file_cache.rb +1 -1
  31. data/lib/chef/formatters/base.rb +2 -2
  32. data/lib/chef/formatters/doc.rb +2 -2
  33. data/lib/chef/http.rb +48 -18
  34. data/lib/chef/http/auth_credentials.rb +1 -1
  35. data/lib/chef/http/basic_client.rb +11 -2
  36. data/lib/chef/http/socketless_chef_zero_client.rb +2 -2
  37. data/lib/chef/key.rb +55 -56
  38. data/lib/chef/knife.rb +70 -61
  39. data/lib/chef/knife/client_delete.rb +2 -2
  40. data/lib/chef/knife/cookbook_bulk_delete.rb +1 -1
  41. data/lib/chef/knife/cookbook_show.rb +1 -1
  42. data/lib/chef/knife/core/gem_glob_loader.rb +3 -3
  43. data/lib/chef/knife/search.rb +2 -2
  44. data/lib/chef/knife/ssh.rb +19 -21
  45. data/lib/chef/knife/status.rb +2 -2
  46. data/lib/chef/mixin/command/unix.rb +2 -2
  47. data/lib/chef/mixin/powershell_type_coercions.rb +1 -1
  48. data/lib/chef/mixin/properties.rb +3 -0
  49. data/lib/chef/mixin/securable.rb +2 -2
  50. data/lib/chef/mixin/shell_out.rb +30 -0
  51. data/lib/chef/mixin/uris.rb +2 -1
  52. data/lib/chef/mixin/windows_architecture_helper.rb +3 -4
  53. data/lib/chef/monkey_patches/webrick-utils.rb +2 -2
  54. data/lib/chef/monologger.rb +1 -1
  55. data/lib/chef/node.rb +2 -2
  56. data/lib/chef/node/attribute.rb +3 -3
  57. data/lib/chef/platform/provider_mapping.rb +5 -2
  58. data/lib/chef/property.rb +14 -3
  59. data/lib/chef/provider/apt_repository.rb +3 -7
  60. data/lib/chef/provider/apt_update.rb +4 -6
  61. data/lib/chef/provider/cron.rb +1 -2
  62. data/lib/chef/provider/dsc_script.rb +4 -4
  63. data/lib/chef/provider/group/usermod.rb +1 -1
  64. data/lib/chef/provider/link.rb +10 -3
  65. data/lib/chef/provider/osx_profile.rb +10 -10
  66. data/lib/chef/provider/package.rb +2 -12
  67. data/lib/chef/provider/package/rubygems.rb +17 -16
  68. data/lib/chef/provider/package/windows.rb +2 -0
  69. data/lib/chef/provider/package/windows/exe.rb +1 -1
  70. data/lib/chef/provider/package/windows/registry_uninstall_entry.rb +0 -2
  71. data/lib/chef/provider/package/yum/rpm_utils.rb +8 -8
  72. data/lib/chef/provider/package/yum/yum_cache.rb +1 -1
  73. data/lib/chef/provider/remote_file/ftp.rb +2 -2
  74. data/lib/chef/provider/remote_file/sftp.rb +2 -2
  75. data/lib/chef/provider/service/debian.rb +2 -2
  76. data/lib/chef/provider/service/simple.rb +4 -3
  77. data/lib/chef/provider/service/solaris.rb +1 -1
  78. data/lib/chef/provider/service/systemd.rb +2 -2
  79. data/lib/chef/provider/service/upstart.rb +8 -5
  80. data/lib/chef/provider/support/yum_repo.erb +125 -0
  81. data/lib/chef/provider/systemd_unit.rb +11 -2
  82. data/lib/chef/provider/template_finder.rb +1 -1
  83. data/lib/chef/provider/user.rb +20 -16
  84. data/lib/chef/provider/user/aix.rb +5 -2
  85. data/lib/chef/provider/user/dscl.rb +1 -0
  86. data/lib/chef/provider/user/linux.rb +128 -0
  87. data/lib/chef/provider/user/pw.rb +2 -1
  88. data/lib/chef/provider/user/solaris.rb +3 -2
  89. data/lib/chef/provider/user/useradd.rb +5 -4
  90. data/lib/chef/provider/user/windows.rb +1 -1
  91. data/lib/chef/provider/windows_script.rb +5 -2
  92. data/lib/chef/provider/yum_repository.rb +121 -0
  93. data/lib/chef/providers.rb +4 -2
  94. data/lib/chef/resource.rb +7 -9
  95. data/lib/chef/resource/conditional.rb +9 -1
  96. data/lib/chef/resource/launchd.rb +1 -1
  97. data/lib/chef/resource/user.rb +3 -3
  98. data/lib/chef/resource/user/aix_user.rb +31 -0
  99. data/lib/chef/resource/user/dscl_user.rb +31 -0
  100. data/lib/chef/resource/user/linux_user.rb +51 -0
  101. data/lib/chef/resource/user/pw_user.rb +31 -0
  102. data/lib/chef/resource/user/solaris_user.rb +31 -0
  103. data/lib/chef/resource/user/windows_user.rb +31 -0
  104. data/lib/chef/resource/yum_package.rb +13 -12
  105. data/lib/chef/resource/yum_repository.rb +76 -0
  106. data/lib/chef/resource_builder.rb +1 -1
  107. data/lib/chef/resource_collection/stepable_iterator.rb +1 -3
  108. data/lib/chef/resource_reporter.rb +5 -5
  109. data/lib/chef/resources.rb +7 -0
  110. data/lib/chef/run_context.rb +5 -3
  111. data/lib/chef/run_context/cookbook_compiler.rb +3 -2
  112. data/lib/chef/run_list.rb +2 -2
  113. data/lib/chef/search/query.rb +11 -8
  114. data/lib/chef/shell/ext.rb +2 -2
  115. data/lib/chef/shell/shell_session.rb +1 -1
  116. data/lib/chef/util/dsc/configuration_generator.rb +1 -1
  117. data/lib/chef/util/powershell/cmdlet.rb +5 -2
  118. data/lib/chef/util/selinux.rb +1 -1
  119. data/lib/chef/version.rb +1 -1
  120. data/lib/chef/version_class.rb +2 -2
  121. data/lib/chef/version_constraint.rb +2 -2
  122. data/lib/chef/win32/api/error.rb +2 -2
  123. data/lib/chef/win32/api/net.rb +1 -1
  124. data/lib/chef/win32/eventlog.rb +1 -1
  125. data/lib/chef/win32/net.rb +1 -1
  126. data/lib/chef/win32/security/sid.rb +1 -1
  127. data/spec/functional/assets/testchefsubsys +2 -3
  128. data/spec/functional/event_loggers/windows_eventlog_spec.rb +11 -8
  129. data/spec/functional/file_content_management/deploy_strategies_spec.rb +1 -1
  130. data/spec/functional/http/simple_spec.rb +2 -2
  131. data/spec/functional/knife/cookbook_delete_spec.rb +5 -5
  132. data/spec/functional/knife/exec_spec.rb +6 -6
  133. data/spec/functional/knife/ssh_spec.rb +4 -4
  134. data/spec/functional/notifications_spec.rb +2 -2
  135. data/spec/functional/provider/whyrun_safe_ruby_block_spec.rb +2 -2
  136. data/spec/functional/rebooter_spec.rb +5 -5
  137. data/spec/functional/resource/bash_spec.rb +2 -2
  138. data/spec/functional/resource/deploy_revision_spec.rb +1 -1
  139. data/spec/functional/resource/dpkg_package_spec.rb +2 -2
  140. data/spec/functional/resource/dsc_resource_spec.rb +5 -5
  141. data/spec/functional/resource/dsc_script_spec.rb +27 -22
  142. data/spec/functional/resource/env_spec.rb +4 -4
  143. data/spec/functional/resource/execute_spec.rb +4 -4
  144. data/spec/functional/resource/group_spec.rb +20 -8
  145. data/spec/functional/resource/link_spec.rb +34 -0
  146. data/spec/functional/resource/ohai_spec.rb +6 -6
  147. data/spec/functional/resource/reboot_spec.rb +2 -2
  148. data/spec/functional/resource/remote_file_spec.rb +16 -7
  149. data/spec/functional/resource/user/dscl_spec.rb +3 -3
  150. data/spec/functional/resource/user/useradd_spec.rb +32 -26
  151. data/spec/functional/resource/windows_service_spec.rb +15 -15
  152. data/spec/functional/rest_spec.rb +2 -2
  153. data/spec/functional/run_lock_spec.rb +9 -9
  154. data/spec/functional/tiny_server_spec.rb +9 -8
  155. data/spec/functional/win32/crypto_spec.rb +1 -1
  156. data/spec/functional/win32/security_spec.rb +8 -8
  157. data/spec/integration/client/client_spec.rb +6 -4
  158. data/spec/integration/knife/chef_repo_path_spec.rb +70 -1
  159. data/spec/integration/knife/upload_spec.rb +1 -1
  160. data/spec/integration/recipes/lwrp_inline_resources_spec.rb +6 -6
  161. data/spec/integration/recipes/noop_resource_spec.rb +4 -4
  162. data/spec/integration/recipes/provider_choice.rb +3 -3
  163. data/spec/integration/recipes/recipe_dsl_spec.rb +318 -317
  164. data/spec/integration/recipes/resource_action_spec.rb +50 -54
  165. data/spec/integration/recipes/resource_converge_if_changed_spec.rb +34 -34
  166. data/spec/integration/recipes/resource_load_spec.rb +24 -24
  167. data/spec/integration/solo/solo_spec.rb +21 -30
  168. data/spec/scripts/ssl-serve.rb +1 -1
  169. data/spec/spec_helper.rb +1 -0
  170. data/spec/stress/win32/security_spec.rb +4 -4
  171. data/spec/support/chef_helpers.rb +22 -0
  172. data/spec/support/platform_helpers.rb +5 -1
  173. data/spec/support/shared/context/client.rb +3 -2
  174. data/spec/support/shared/functional/file_resource.rb +5 -4
  175. data/spec/support/shared/functional/http.rb +16 -16
  176. data/spec/support/shared/functional/securable_resource.rb +5 -5
  177. data/spec/support/shared/functional/win32_service.rb +5 -7
  178. data/spec/support/shared/integration/app_server_support.rb +1 -3
  179. data/spec/support/shared/integration/knife_support.rb +0 -2
  180. data/spec/support/shared/shared_examples.rb +2 -2
  181. data/spec/support/shared/unit/api_versioning.rb +2 -2
  182. data/spec/support/shared/unit/application_dot_d.rb +9 -6
  183. data/spec/support/shared/unit/provider/file.rb +2 -2
  184. data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +49 -80
  185. data/spec/support/shared/unit/resource/static_provider_resolution.rb +2 -2
  186. data/spec/support/shared/unit/script_resource.rb +4 -4
  187. data/spec/support/shared/unit/user_and_client_shared.rb +4 -4
  188. data/spec/tiny_server.rb +51 -66
  189. data/spec/unit/api_client_v1_spec.rb +2 -2
  190. data/spec/unit/application_spec.rb +1 -1
  191. data/spec/unit/audit/audit_event_proxy_spec.rb +34 -27
  192. data/spec/unit/audit/audit_reporter_spec.rb +32 -23
  193. data/spec/unit/audit/control_group_data_spec.rb +19 -14
  194. data/spec/unit/chef_class_spec.rb +1 -1
  195. data/spec/unit/chef_fs/data_handler/group_handler_spec.rb +1 -1
  196. data/spec/unit/chef_fs/diff_spec.rb +4 -4
  197. data/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb +4 -4
  198. data/spec/unit/chef_fs/file_system_spec.rb +2 -2
  199. data/spec/unit/chef_fs/parallelizer.rb +5 -7
  200. data/spec/unit/cookbook/metadata_spec.rb +98 -98
  201. data/spec/unit/cookbook/synchronizer_spec.rb +7 -0
  202. data/spec/unit/cookbook_loader_spec.rb +24 -24
  203. data/spec/unit/cookbook_version_file_specificity_spec.rb +8 -8
  204. data/spec/unit/daemon_spec.rb +1 -1
  205. data/spec/unit/data_bag_item_spec.rb +18 -18
  206. data/spec/unit/data_bag_spec.rb +2 -2
  207. data/spec/unit/data_collector/messages/helpers_spec.rb +9 -9
  208. data/spec/unit/data_collector/messages_spec.rb +2 -2
  209. data/spec/unit/data_collector_spec.rb +19 -19
  210. data/spec/unit/dsl/audit_spec.rb +3 -3
  211. data/spec/unit/dsl/data_query_spec.rb +3 -2
  212. data/spec/unit/dsl/declare_resource_spec.rb +10 -10
  213. data/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb +3 -2
  214. data/spec/unit/encrypted_data_bag_item_spec.rb +3 -2
  215. data/spec/unit/environment_spec.rb +6 -6
  216. data/spec/unit/event_dispatch/dispatcher_spec.rb +2 -2
  217. data/spec/unit/file_access_control_spec.rb +3 -3
  218. data/spec/unit/file_content_management/tempfile_spec.rb +2 -2
  219. data/spec/unit/formatters/error_inspectors/api_error_formatting_spec.rb +2 -2
  220. data/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb +2 -2
  221. data/spec/unit/http/basic_client_spec.rb +20 -0
  222. data/spec/unit/http/validate_content_length_spec.rb +8 -8
  223. data/spec/unit/http_spec.rb +14 -0
  224. data/spec/unit/knife/bootstrap/chef_vault_handler_spec.rb +2 -2
  225. data/spec/unit/knife/bootstrap/client_builder_spec.rb +2 -2
  226. data/spec/unit/knife/bootstrap_spec.rb +8 -6
  227. data/spec/unit/knife/client_bulk_delete_spec.rb +8 -8
  228. data/spec/unit/knife/client_edit_spec.rb +2 -2
  229. data/spec/unit/knife/configure_client_spec.rb +2 -2
  230. data/spec/unit/knife/cookbook_metadata_spec.rb +4 -4
  231. data/spec/unit/knife/cookbook_site_install_spec.rb +6 -5
  232. data/spec/unit/knife/cookbook_site_share_spec.rb +2 -2
  233. data/spec/unit/knife/core/hashed_command_loader_spec.rb +5 -4
  234. data/spec/unit/knife/core/node_editor_spec.rb +3 -3
  235. data/spec/unit/knife/core/ui_spec.rb +2 -2
  236. data/spec/unit/knife/data_bag_from_file_spec.rb +4 -3
  237. data/spec/unit/knife/data_bag_show_spec.rb +3 -2
  238. data/spec/unit/knife/key_create_spec.rb +14 -14
  239. data/spec/unit/knife/key_delete_spec.rb +2 -2
  240. data/spec/unit/knife/key_edit_spec.rb +16 -16
  241. data/spec/unit/knife/key_list_spec.rb +6 -6
  242. data/spec/unit/knife/key_show_spec.rb +4 -4
  243. data/spec/unit/knife/status_spec.rb +3 -2
  244. data/spec/unit/knife/user_create_spec.rb +4 -4
  245. data/spec/unit/knife_spec.rb +7 -6
  246. data/spec/unit/lwrp_spec.rb +6 -6
  247. data/spec/unit/mixin/api_version_request_handling_spec.rb +2 -2
  248. data/spec/unit/mixin/command_spec.rb +17 -14
  249. data/spec/unit/mixin/deprecation_spec.rb +1 -1
  250. data/spec/unit/mixin/homebrew_user_spec.rb +2 -2
  251. data/spec/unit/mixin/params_validate_spec.rb +53 -52
  252. data/spec/unit/mixin/powershell_out_spec.rb +2 -2
  253. data/spec/unit/mixin/powershell_type_coercions_spec.rb +2 -2
  254. data/spec/unit/mixin/shell_out_spec.rb +1 -1
  255. data/spec/unit/mixin/xml_escape_spec.rb +3 -3
  256. data/spec/unit/node_spec.rb +2 -2
  257. data/spec/unit/platform/query_helpers_spec.rb +3 -3
  258. data/spec/unit/property_spec.rb +4 -4
  259. data/spec/unit/provider/cookbook_file_spec.rb +4 -4
  260. data/spec/unit/provider/cron/unix_spec.rb +4 -4
  261. data/spec/unit/provider/cron_spec.rb +2 -2
  262. data/spec/unit/provider/deploy_spec.rb +8 -8
  263. data/spec/unit/provider/dsc_resource_spec.rb +11 -10
  264. data/spec/unit/provider/dsc_script_spec.rb +9 -9
  265. data/spec/unit/provider/env/windows_spec.rb +8 -8
  266. data/spec/unit/provider/file/content_spec.rb +6 -6
  267. data/spec/unit/provider/file_spec.rb +4 -4
  268. data/spec/unit/provider/launchd_spec.rb +2 -1
  269. data/spec/unit/provider/link_spec.rb +155 -0
  270. data/spec/unit/provider/mount/mount_spec.rb +5 -5
  271. data/spec/unit/provider/mount/solaris_spec.rb +48 -48
  272. data/spec/unit/provider/osx_profile_spec.rb +6 -0
  273. data/spec/unit/provider/package/chocolatey_spec.rb +4 -4
  274. data/spec/unit/provider/package/freebsd/port_spec.rb +4 -4
  275. data/spec/unit/provider/package/rubygems_spec.rb +50 -44
  276. data/spec/unit/provider/package/windows/exe_spec.rb +9 -0
  277. data/spec/unit/provider/package/yum_spec.rb +61 -60
  278. data/spec/unit/provider/package_spec.rb +2 -2
  279. data/spec/unit/provider/powershell_script_spec.rb +4 -4
  280. data/spec/unit/provider/remote_directory_spec.rb +1 -1
  281. data/spec/unit/provider/remote_file/ftp_spec.rb +4 -4
  282. data/spec/unit/provider/remote_file/local_file_spec.rb +4 -2
  283. data/spec/unit/provider/remote_file/sftp_spec.rb +4 -4
  284. data/spec/unit/provider/remote_file_spec.rb +4 -4
  285. data/spec/unit/provider/script_spec.rb +4 -4
  286. data/spec/unit/provider/service/debian_service_spec.rb +4 -4
  287. data/spec/unit/provider/service/freebsd_service_spec.rb +12 -8
  288. data/spec/unit/provider/service/openbsd_service_spec.rb +12 -8
  289. data/spec/unit/provider/service/systemd_service_spec.rb +4 -4
  290. data/spec/unit/provider/service/upstart_service_spec.rb +27 -12
  291. data/spec/unit/provider/service/windows_spec.rb +10 -10
  292. data/spec/unit/provider/systemd_unit_spec.rb +2 -2
  293. data/spec/unit/provider/template/content_spec.rb +8 -8
  294. data/spec/unit/provider/template_spec.rb +8 -8
  295. data/spec/unit/provider/user/dscl_spec.rb +51 -51
  296. data/spec/unit/provider/user/linux_spec.rb +76 -0
  297. data/spec/unit/provider/user/pw_spec.rb +3 -6
  298. data/spec/unit/provider/user/solaris_spec.rb +5 -5
  299. data/spec/unit/provider/user/windows_spec.rb +3 -3
  300. data/spec/unit/provider/user_spec.rb +2 -2
  301. data/spec/unit/provider/yum_repository_spec.rb +35 -0
  302. data/spec/unit/provider_resolver_spec.rb +306 -264
  303. data/spec/unit/recipe_spec.rb +8 -7
  304. data/spec/unit/resource/apt_repository_spec.rb +4 -4
  305. data/spec/unit/resource/apt_update_spec.rb +4 -4
  306. data/spec/unit/resource/conditional_spec.rb +46 -0
  307. data/spec/unit/resource/dsc_resource_spec.rb +8 -8
  308. data/spec/unit/resource/dsc_script_spec.rb +4 -4
  309. data/spec/unit/resource/freebsd_package_spec.rb +6 -6
  310. data/spec/unit/resource/launchd_spec.rb +3 -2
  311. data/spec/unit/resource/osx_profile_spec.rb +3 -2
  312. data/spec/unit/resource/remote_file_spec.rb +6 -6
  313. data/spec/unit/resource/service_spec.rb +14 -14
  314. data/spec/unit/resource/user_spec.rb +1 -1
  315. data/spec/unit/resource/yum_repository_spec.rb +49 -0
  316. data/spec/unit/resource_collection_spec.rb +4 -4
  317. data/spec/unit/resource_definition_spec.rb +11 -11
  318. data/spec/unit/resource_reporter_spec.rb +4 -4
  319. data/spec/unit/resource_resolver_spec.rb +6 -6
  320. data/spec/unit/resource_spec.rb +36 -16
  321. data/spec/unit/run_context/child_run_context_spec.rb +4 -4
  322. data/spec/unit/run_context/cookbook_compiler_spec.rb +43 -1
  323. data/spec/unit/run_context_spec.rb +8 -8
  324. data/spec/unit/run_list/run_list_expansion_spec.rb +2 -2
  325. data/spec/unit/runner_spec.rb +2 -2
  326. data/spec/unit/search/query_spec.rb +15 -14
  327. data/spec/unit/user_v1_spec.rb +8 -8
  328. data/spec/unit/util/dsc/configuration_generator_spec.rb +12 -12
  329. data/spec/unit/util/dsc/local_configuration_manager_spec.rb +12 -9
  330. data/spec/unit/util/dsc/resource_store.rb +8 -6
  331. data/spec/unit/util/editor_spec.rb +6 -6
  332. data/spec/unit/util/powershell/cmdlet_spec.rb +10 -10
  333. data/tasks/bin/bundle-platform +1 -0
  334. data/tasks/bin/bundler_patch.rb +27 -0
  335. data/tasks/cbgb.rb +2 -2
  336. data/tasks/maintainers.rb +2 -2
  337. metadata +37 -8
  338. data/spec/unit/provider/user/useradd_spec.rb +0 -51
@@ -27,7 +27,7 @@ describe Chef::Knife::ClientEdit do
27
27
  end
28
28
 
29
29
  describe "run" do
30
- let(:data) {
30
+ let(:data) do
31
31
  {
32
32
  "name" => "adam",
33
33
  "validator" => false,
@@ -35,7 +35,7 @@ describe Chef::Knife::ClientEdit do
35
35
  "chef_type" => "client",
36
36
  "create_key" => true,
37
37
  }
38
- }
38
+ end
39
39
 
40
40
  it "should edit the client" do
41
41
  allow(Chef::ApiClientV1).to receive(:load).with("adam").and_return(data)
@@ -33,9 +33,9 @@ describe Chef::Knife::ConfigureClient do
33
33
  it "should print usage and exit when a directory is not provided" do
34
34
  expect(@knife).to receive(:show_usage)
35
35
  expect(@knife.ui).to receive(:fatal).with(/must provide the directory/)
36
- expect {
36
+ expect do
37
37
  @knife.run
38
- }.to raise_error SystemExit
38
+ end.to raise_error SystemExit
39
39
  end
40
40
 
41
41
  describe "when specifing a directory" do
@@ -128,9 +128,9 @@ describe Chef::Knife::CookbookMetadata do
128
128
  it "should print an error and exit when an #{description} syntax exception is encountered" do
129
129
  exception = klass.new("#{description} blah")
130
130
  allow(Chef::Cookbook::Metadata).to receive(:new).and_raise(exception)
131
- expect {
131
+ expect do
132
132
  @knife.generate_metadata_from_file("foobar", "#{@cookbook_dir}/foobar/metadata.rb")
133
- }.to raise_error(SystemExit)
133
+ end.to raise_error(SystemExit)
134
134
  expect(@stderr.string).to match /error: the cookbook 'foobar' contains invalid or obsolete metadata syntax/im
135
135
  expect(@stderr.string).to match /in #{@cookbook_dir}\/foobar\/metadata\.rb/im
136
136
  expect(@stderr.string).to match /#{description} blah/im
@@ -166,9 +166,9 @@ describe Chef::Knife::CookbookMetadata do
166
166
  and_return(@json_data)
167
167
  exception = klass.new("#{description} blah")
168
168
  allow(Chef::Cookbook::Metadata).to receive(:validate_json).and_raise(exception)
169
- expect {
169
+ expect do
170
170
  @knife.validate_metadata_json(@cookbook_dir, "foobar")
171
- }.to raise_error(SystemExit)
171
+ end.to raise_error(SystemExit)
172
172
  expect(@stderr.string).to match /error: the cookbook 'foobar' contains invalid or obsolete metadata syntax/im
173
173
  expect(@stderr.string).to match /in #{@cookbook_dir}\/foobar\/metadata\.json/im
174
174
  expect(@stderr.string).to match /#{description} blah/im
@@ -24,16 +24,17 @@ describe Chef::Knife::CookbookSiteInstall do
24
24
  let(:stderr) { StringIO.new }
25
25
  let(:downloader) { Hash.new }
26
26
  let(:archive) { double(Mixlib::Archive, extract: true) }
27
- let(:repo) { double(:sanity_check => true, :reset_to_default_state => true,
28
- :prepare_to_import => true, :finalize_updates_to => true,
29
- :merge_updates_from => true) }
30
- let(:install_path) {
27
+ let(:repo) do
28
+ double(:sanity_check => true, :reset_to_default_state => true,
29
+ :prepare_to_import => true, :finalize_updates_to => true,
30
+ :merge_updates_from => true) end
31
+ let(:install_path) do
31
32
  if Chef::Platform.windows?
32
33
  "C:/tmp/chef"
33
34
  else
34
35
  "/var/tmp/chef"
35
36
  end
36
- }
37
+ end
37
38
 
38
39
  before(:each) do
39
40
  require "chef/knife/core/cookbook_scm_repo"
@@ -199,8 +199,8 @@ describe Chef::Knife::CookbookSiteShare do
199
199
  response_text = Chef::JSONCompat.to_json({ :system_error => "Your call was dropped", :reason => "There's a map for that" })
200
200
  allow(@upload_response).to receive(:body).and_return(response_text)
201
201
  allow(@upload_response).to receive(:code).and_return(500)
202
- expect(@knife.ui).to receive(:error).with(/#{Regexp.escape(response_text)}/)#.ordered
203
- expect(@knife.ui).to receive(:error).with(/Unknown error/)#.ordered
202
+ expect(@knife.ui).to receive(:error).with(/#{Regexp.escape(response_text)}/) #.ordered
203
+ expect(@knife.ui).to receive(:error).with(/Unknown error/) #.ordered
204
204
  expect { @knife.run }.to raise_error(SystemExit)
205
205
  end
206
206
 
@@ -22,7 +22,7 @@ describe Chef::Knife::SubcommandLoader::HashedCommandLoader do
22
22
  allow(ChefConfig).to receive(:windows?) { false }
23
23
  end
24
24
 
25
- let(:plugin_manifest) {
25
+ let(:plugin_manifest) do
26
26
  {
27
27
  "_autogenerated_command_paths" => {
28
28
  "plugins_paths" => {
@@ -39,11 +39,12 @@ describe Chef::Knife::SubcommandLoader::HashedCommandLoader do
39
39
  },
40
40
  },
41
41
  }
42
- }
42
+ end
43
43
 
44
- let(:loader) { Chef::Knife::SubcommandLoader::HashedCommandLoader.new(
44
+ let(:loader) do
45
+ Chef::Knife::SubcommandLoader::HashedCommandLoader.new(
45
46
  File.join(CHEF_SPEC_DATA, "knife-site-subcommands"),
46
- plugin_manifest)}
47
+ plugin_manifest) end
47
48
 
48
49
  describe "#list_commands" do
49
50
  before do
@@ -41,7 +41,7 @@ describe Chef::Knife::NodeEditor do
41
41
 
42
42
  subject { described_class.new(node, ui, config) }
43
43
 
44
- describe '#view' do
44
+ describe "#view" do
45
45
  it "returns a Hash with only the name, chef_environment, normal, " +
46
46
  "policy_name, policy_group, and run_list properties" do
47
47
  expected = node_data.select do |key,|
@@ -61,7 +61,7 @@ describe Chef::Knife::NodeEditor do
61
61
  end
62
62
  end
63
63
 
64
- describe '#apply_updates' do
64
+ describe "#apply_updates" do
65
65
  context "when the node name is changed" do
66
66
  before(:each) do
67
67
  allow(ui).to receive(:warn)
@@ -143,7 +143,7 @@ describe Chef::Knife::NodeEditor do
143
143
  end
144
144
  end
145
145
 
146
- describe '#updated?' do
146
+ describe "#updated?" do
147
147
  context "before the node has been edited" do
148
148
  it "returns false" do
149
149
  expect(subject.updated?).to be false
@@ -500,9 +500,9 @@ EOM
500
500
 
501
501
  shared_examples_for "confirm with negative answer" do
502
502
  it "confirm should exit 3" do
503
- expect {
503
+ expect do
504
504
  run_confirm
505
- }.to raise_error(SystemExit) { |e| expect(e.status).to eq(3) }
505
+ end.to raise_error(SystemExit) { |e| expect(e.status).to eq(3) }
506
506
  end
507
507
 
508
508
  it "confirm_without_exit should return false" do
@@ -52,7 +52,7 @@ describe Chef::Knife::DataBagFromFile do
52
52
  k
53
53
  end
54
54
 
55
- let(:tmp_dir) { Dir.mktmpdir }
55
+ let(:tmp_dir) { make_canonical_temp_directory }
56
56
  let(:db_folder) { File.join(tmp_dir, data_bags_path, bag_name) }
57
57
  let(:db_file) { Tempfile.new(["data_bag_from_file_test", ".json"], db_folder) }
58
58
  let(:db_file2) { Tempfile.new(["data_bag_from_file_test2", ".json"], db_folder) }
@@ -72,11 +72,12 @@ describe Chef::Knife::DataBagFromFile do
72
72
  let(:loader) { double("Knife::Core::ObjectLoader") }
73
73
 
74
74
  let(:data_bags_path) { "data_bags" }
75
- let(:plain_data) { {
75
+ let(:plain_data) do
76
+ {
76
77
  "id" => "item_name",
77
78
  "greeting" => "hello",
78
79
  "nested" => { "a1" => [1, 2, 3], "a2" => { "b1" => true } },
79
- } }
80
+ } end
80
81
  let(:enc_data) { Chef::EncryptedDataBagItem.encrypt_data_bag_item(plain_data, secret) }
81
82
 
82
83
  let(:rest) { double("Chef::ServerAPI") }
@@ -45,8 +45,9 @@ describe Chef::Knife::DataBagShow do
45
45
  let(:bag_name) { "sudoing_admins" }
46
46
  let(:item_name) { "ME" }
47
47
 
48
- let(:data_bag_contents) { { "id" => "id", "baz" => "http://localhost:4000/data/bag_o_data/baz",
49
- "qux" => "http://localhost:4000/data/bag_o_data/qux" } }
48
+ let(:data_bag_contents) do
49
+ { "id" => "id", "baz" => "http://localhost:4000/data/bag_o_data/baz",
50
+ "qux" => "http://localhost:4000/data/bag_o_data/qux" } end
50
51
  let(:enc_hash) { Chef::EncryptedDataBagItem.encrypt_data_bag_item(data_bag_contents, secret) }
51
52
  let(:data_bag) { Chef::DataBagItem.from_hash(data_bag_contents) }
52
53
  let(:data_bag_with_encoded_hash) { Chef::DataBagItem.from_hash(enc_hash) }
@@ -73,7 +73,7 @@ describe "key create commands that inherit knife" do
73
73
  end
74
74
 
75
75
  describe Chef::Knife::KeyCreate do
76
- let(:public_key) {
76
+ let(:public_key) do
77
77
  "-----BEGIN PUBLIC KEY-----
78
78
  MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvPo+oNPB7uuNkws0fC02
79
79
  KxSwdyqPLu0fhI1pOweNKAZeEIiEz2PkybathHWy8snSXGNxsITkf3eyvIIKa8OZ
@@ -83,15 +83,15 @@ IjSmiN/ihHtlhV/VSnBJ5PzT/lRknlrJ4kACoz7Pq9jv+aAx5ft/xE9yDa2DYs0q
83
83
  Tfuc9dUYsFjptWYrV6pfEQ+bgo1OGBXORBFcFL+2D7u9JYquKrMgosznHoEkQNLo
84
84
  0wIDAQAB
85
85
  -----END PUBLIC KEY-----"
86
- }
86
+ end
87
87
  let(:config) { Hash.new }
88
88
  let(:actor) { "charmander" }
89
89
  let(:ui) { instance_double("Chef::Knife::UI") }
90
90
 
91
91
  shared_examples_for "key create run command" do
92
- let(:key_create_object) {
92
+ let(:key_create_object) do
93
93
  described_class.new(actor, actor_field_name, ui, config)
94
- }
94
+ end
95
95
 
96
96
  context "when public_key and key_name weren't passed" do
97
97
  it "raises a Chef::Exceptions::KeyCommandInputError with the proper error message" do
@@ -100,11 +100,11 @@ Tfuc9dUYsFjptWYrV6pfEQ+bgo1OGBXORBFcFL+2D7u9JYquKrMgosznHoEkQNLo
100
100
  end
101
101
 
102
102
  context "when the command is run" do
103
- let(:expected_hash) {
103
+ let(:expected_hash) do
104
104
  {
105
105
  actor_field_name => "charmander",
106
106
  }
107
- }
107
+ end
108
108
 
109
109
  before do
110
110
  allow(File).to receive(:read).and_return(public_key)
@@ -120,14 +120,14 @@ Tfuc9dUYsFjptWYrV6pfEQ+bgo1OGBXORBFcFL+2D7u9JYquKrMgosznHoEkQNLo
120
120
  context "when a valid hash is passed" do
121
121
  let(:key_name) { "charmander-key" }
122
122
  let(:valid_expiration_date) { "2020-12-24T21:00:00Z" }
123
- let(:expected_hash) {
123
+ let(:expected_hash) do
124
124
  {
125
125
  actor_field_name => "charmander",
126
126
  "public_key" => public_key,
127
127
  "expiration_date" => valid_expiration_date,
128
128
  "key_name" => key_name,
129
129
  }
130
- }
130
+ end
131
131
  before do
132
132
  key_create_object.config[:public_key] = "public_key_path"
133
133
  key_create_object.config[:expiration_Date] = valid_expiration_date,
@@ -141,12 +141,12 @@ Tfuc9dUYsFjptWYrV6pfEQ+bgo1OGBXORBFcFL+2D7u9JYquKrMgosznHoEkQNLo
141
141
  end
142
142
 
143
143
  context "when public_key is passed" do
144
- let(:expected_hash) {
144
+ let(:expected_hash) do
145
145
  {
146
146
  actor_field_name => "charmander",
147
147
  "public_key" => public_key,
148
148
  }
149
- }
149
+ end
150
150
  before do
151
151
  key_create_object.config[:public_key] = "public_key_path"
152
152
  end
@@ -158,13 +158,13 @@ Tfuc9dUYsFjptWYrV6pfEQ+bgo1OGBXORBFcFL+2D7u9JYquKrMgosznHoEkQNLo
158
158
  end # when public_key is passed
159
159
 
160
160
  context "when public_key isn't passed and key_name is" do
161
- let(:expected_hash) {
161
+ let(:expected_hash) do
162
162
  {
163
163
  actor_field_name => "charmander",
164
164
  "name" => "charmander-key",
165
165
  "create_key" => true,
166
166
  }
167
- }
167
+ end
168
168
  before do
169
169
  key_create_object.config[:key_name] = "charmander-key"
170
170
  end
@@ -176,13 +176,13 @@ Tfuc9dUYsFjptWYrV6pfEQ+bgo1OGBXORBFcFL+2D7u9JYquKrMgosznHoEkQNLo
176
176
  end
177
177
 
178
178
  context "when the server returns a private key" do
179
- let(:expected_hash) {
179
+ let(:expected_hash) do
180
180
  {
181
181
  actor_field_name => "charmander",
182
182
  "public_key" => public_key,
183
183
  "private_key" => "super_private",
184
184
  }
185
- }
185
+ end
186
186
 
187
187
  before do
188
188
  key_create_object.config[:public_key] = "public_key_path"
@@ -80,9 +80,9 @@ describe Chef::Knife::KeyDelete do
80
80
  let(:ui) { instance_double("Chef::Knife::UI") }
81
81
 
82
82
  shared_examples_for "key delete run command" do
83
- let(:key_delete_object) {
83
+ let(:key_delete_object) do
84
84
  described_class.new(keyname, actor, actor_field_name, ui)
85
- }
85
+ end
86
86
 
87
87
  before do
88
88
  allow_any_instance_of(Chef::Key).to receive(:destroy)
@@ -75,7 +75,7 @@ describe "key edit commands that inherit knife" do
75
75
  end
76
76
 
77
77
  describe Chef::Knife::KeyEdit do
78
- let(:public_key) {
78
+ let(:public_key) do
79
79
  "-----BEGIN PUBLIC KEY-----
80
80
  MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvPo+oNPB7uuNkws0fC02
81
81
  KxSwdyqPLu0fhI1pOweNKAZeEIiEz2PkybathHWy8snSXGNxsITkf3eyvIIKa8OZ
@@ -85,23 +85,23 @@ IjSmiN/ihHtlhV/VSnBJ5PzT/lRknlrJ4kACoz7Pq9jv+aAx5ft/xE9yDa2DYs0q
85
85
  Tfuc9dUYsFjptWYrV6pfEQ+bgo1OGBXORBFcFL+2D7u9JYquKrMgosznHoEkQNLo
86
86
  0wIDAQAB
87
87
  -----END PUBLIC KEY-----"
88
- }
88
+ end
89
89
  let(:config) { Hash.new }
90
90
  let(:actor) { "charmander" }
91
91
  let(:keyname) { "charmander-key" }
92
92
  let(:ui) { instance_double("Chef::Knife::UI") }
93
93
 
94
94
  shared_examples_for "key edit run command" do
95
- let(:key_edit_object) {
95
+ let(:key_edit_object) do
96
96
  described_class.new(keyname, actor, actor_field_name, ui, config)
97
- }
97
+ end
98
98
 
99
99
  context "when the command is run" do
100
- let(:expected_hash) {
100
+ let(:expected_hash) do
101
101
  {
102
102
  actor_field_name => "charmander",
103
103
  }
104
- }
104
+ end
105
105
  let(:new_keyname) { "charizard-key" }
106
106
 
107
107
  before do
@@ -126,12 +126,12 @@ Tfuc9dUYsFjptWYrV6pfEQ+bgo1OGBXORBFcFL+2D7u9JYquKrMgosznHoEkQNLo
126
126
  end
127
127
 
128
128
  context "when key_name is passed" do
129
- let(:expected_hash) {
129
+ let(:expected_hash) do
130
130
  {
131
131
  actor_field_name => "charmander",
132
132
  "name" => new_keyname,
133
133
  }
134
- }
134
+ end
135
135
  before do
136
136
  key_edit_object.config[:key_name] = new_keyname
137
137
  allow_any_instance_of(Chef::Key).to receive(:update)
@@ -155,14 +155,14 @@ Tfuc9dUYsFjptWYrV6pfEQ+bgo1OGBXORBFcFL+2D7u9JYquKrMgosznHoEkQNLo
155
155
  end
156
156
 
157
157
  context "when public_key, key_name, and expiration_date are passed" do
158
- let(:expected_hash) {
158
+ let(:expected_hash) do
159
159
  {
160
160
  actor_field_name => "charmander",
161
161
  "public_key" => public_key,
162
162
  "name" => new_keyname,
163
163
  "expiration_date" => "infinity",
164
164
  }
165
- }
165
+ end
166
166
  before do
167
167
  key_edit_object.config[:public_key] = "this-public-key"
168
168
  key_edit_object.config[:key_name] = new_keyname
@@ -177,12 +177,12 @@ Tfuc9dUYsFjptWYrV6pfEQ+bgo1OGBXORBFcFL+2D7u9JYquKrMgosznHoEkQNLo
177
177
  end
178
178
 
179
179
  context "when create_key is passed" do
180
- let(:expected_hash) {
180
+ let(:expected_hash) do
181
181
  {
182
182
  actor_field_name => "charmander",
183
183
  "create_key" => true,
184
184
  }
185
- }
185
+ end
186
186
 
187
187
  before do
188
188
  key_edit_object.config[:create_key] = true
@@ -196,12 +196,12 @@ Tfuc9dUYsFjptWYrV6pfEQ+bgo1OGBXORBFcFL+2D7u9JYquKrMgosznHoEkQNLo
196
196
  end
197
197
 
198
198
  context "when public_key is passed" do
199
- let(:expected_hash) {
199
+ let(:expected_hash) do
200
200
  {
201
201
  actor_field_name => "charmander",
202
202
  "public_key" => public_key,
203
203
  }
204
- }
204
+ end
205
205
  before do
206
206
  allow(key_edit_object).to receive(:update_key_from_hash).and_return(Chef::Key.from_hash(expected_hash))
207
207
  key_edit_object.config[:public_key] = "public_key_path"
@@ -214,13 +214,13 @@ Tfuc9dUYsFjptWYrV6pfEQ+bgo1OGBXORBFcFL+2D7u9JYquKrMgosznHoEkQNLo
214
214
  end # when public_key is passed
215
215
 
216
216
  context "when the server returns a private key" do
217
- let(:expected_hash) {
217
+ let(:expected_hash) do
218
218
  {
219
219
  actor_field_name => "charmander",
220
220
  "public_key" => public_key,
221
221
  "private_key" => "super_private",
222
222
  }
223
- }
223
+ end
224
224
 
225
225
  before do
226
226
  allow(key_edit_object).to receive(:update_key_from_hash).and_return(Chef::Key.from_hash(expected_hash))
@@ -78,9 +78,9 @@ describe Chef::Knife::KeyList do
78
78
  let(:ui) { instance_double("Chef::Knife::UI") }
79
79
 
80
80
  shared_examples_for "key list run command" do
81
- let(:key_list_object) {
81
+ let(:key_list_object) do
82
82
  described_class.new(actor, list_method, ui, config)
83
- }
83
+ end
84
84
 
85
85
  before do
86
86
  allow(Chef::Key).to receive(list_method).and_return(http_response)
@@ -191,26 +191,26 @@ describe Chef::Knife::KeyList do
191
191
  context "when list_method is :list_by_user" do
192
192
  it_should_behave_like "key list run command" do
193
193
  let(:list_method) { :list_by_user }
194
- let(:http_response) {
194
+ let(:http_response) do
195
195
  [
196
196
  { "uri" => "https://api.opscode.piab/users/charmander/keys/non-expired1", "name" => "non-expired1", "expired" => false },
197
197
  { "uri" => "https://api.opscode.piab/users/charmander/keys/non-expired2", "name" => "non-expired2", "expired" => false },
198
198
  { "uri" => "https://api.opscode.piab/users/mary/keys/out-of-date", "name" => "out-of-date", "expired" => true },
199
199
  ]
200
- }
200
+ end
201
201
  end
202
202
  end
203
203
 
204
204
  context "when list_method is :list_by_client" do
205
205
  it_should_behave_like "key list run command" do
206
206
  let(:list_method) { :list_by_client }
207
- let(:http_response) {
207
+ let(:http_response) do
208
208
  [
209
209
  { "uri" => "https://api.opscode.piab/organizations/pokemon/clients/charmander/keys/non-expired1", "name" => "non-expired1", "expired" => false },
210
210
  { "uri" => "https://api.opscode.piab/organizations/pokemon/clients/charmander/keys/non-expired2", "name" => "non-expired2", "expired" => false },
211
211
  { "uri" => "https://api.opscode.piab/organizations/pokemon/clients/mary/keys/out-of-date", "name" => "out-of-date", "expired" => true },
212
212
  ]
213
- }
213
+ end
214
214
  end
215
215
  end
216
216
  end