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
@@ -238,6 +238,12 @@ describe Chef::Provider::OsxProfile do
238
238
  ).to eql(new_resource.identifier)
239
239
  end
240
240
 
241
+ it "should work with spaces in the identifier" do
242
+ provider.action = :remove
243
+ provider.define_resource_requirements
244
+ expect { provider.process_resource_requirements }.not_to raise_error
245
+ end
246
+
241
247
  it "should build the shellout remove command correctly" do
242
248
  new_resource.identifier "com.testprofile.screensaver"
243
249
  new_resource.action(:remove)
@@ -462,18 +462,18 @@ describe "behavior when Chocolatey is not installed" do
462
462
  Chef::Provider::Package::Chocolatey.new(new_resource, run_context)
463
463
  end
464
464
 
465
- before {
465
+ before do
466
466
  # the shellout sometimes returns "", but test nil to be safe.
467
467
  allow(provider).to receive(:choco_install_path).and_return(nil)
468
468
  provider.instance_variable_set("@choco_install_path", nil)
469
469
 
470
470
  # we don't care what this returns, but we have to let it be called.
471
471
  allow(provider).to receive(:shell_out!).and_return(double(:stdout => ""))
472
- }
472
+ end
473
473
 
474
- let(:error_regex) {
474
+ let(:error_regex) do
475
475
  /Could not locate.*install.*cookbook.*PowerShell.*GetEnvironmentVariable/m
476
- }
476
+ end
477
477
 
478
478
  context "#choco_exe" do
479
479
  it "triggers a MissingLibrary exception when Chocolatey is not installed" do
@@ -74,8 +74,8 @@ describe Chef::Provider::Package::Freebsd::Port do
74
74
 
75
75
  it "should check 'pkg info' if make supports WITH_PKGNG if freebsd version is < 1000017" do
76
76
  pkg_enabled = OpenStruct.new(:stdout => "yes\n")
77
- [1000016, 1000000, 901503, 902506, 802511].each do |__freebsd_version|
78
- @node.automatic_attrs[:os_version] = __freebsd_version
77
+ [1000016, 1000000, 901503, 902506, 802511].each do |freebsd_version|
78
+ @node.automatic_attrs[:os_version] = freebsd_version
79
79
  expect(@new_resource).to receive(:shell_out!).with("make -V WITH_PKGNG", env: nil).and_return(pkg_enabled)
80
80
  expect(@provider).to receive(:shell_out!).with('pkg info "zsh"', env: nil, returns: [0, 70], timeout: 900).and_return(@pkg_info)
81
81
  expect(@provider.current_installed_version).to eq("3.1.7")
@@ -83,8 +83,8 @@ describe Chef::Provider::Package::Freebsd::Port do
83
83
  end
84
84
 
85
85
  it "should check 'pkg info' if the freebsd version is greater than or equal to 1000017" do
86
- __freebsd_version = 1000017
87
- @node.automatic_attrs[:os_version] = __freebsd_version
86
+ freebsd_version = 1000017
87
+ @node.automatic_attrs[:os_version] = freebsd_version
88
88
  expect(@provider).to receive(:shell_out!).with('pkg info "zsh"', env: nil, returns: [0, 70], timeout: 900).and_return(@pkg_info)
89
89
  expect(@provider.current_installed_version).to eq("3.1.7")
90
90
  end
@@ -16,7 +16,6 @@
16
16
  # See the License for the specific language governing permissions and
17
17
  # limitations under the License.
18
18
  #
19
- require "pp"
20
19
 
21
20
  module GemspecBackcompatCreator
22
21
  def gemspec(name, version)
@@ -64,7 +63,7 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
64
63
  begin
65
64
  @gem_env.with_gem_sources("http://gems.example.org") do
66
65
  sources_in_block = Gem.sources
67
- raise RuntimeError, "sources should be reset even in case of an error"
66
+ raise "sources should be reset even in case of an error"
68
67
  end
69
68
  rescue RuntimeError
70
69
  end
@@ -78,7 +77,7 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
78
77
  begin
79
78
  @gem_env.with_gem_sources(nil) do
80
79
  sources_in_block = Gem.sources
81
- raise RuntimeError, "sources should be reset even in case of an error"
80
+ raise "sources should be reset even in case of an error"
82
81
  end
83
82
  rescue RuntimeError
84
83
  end
@@ -86,34 +85,55 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
86
85
  expect(Gem.sources).to eq(normal_sources)
87
86
  end
88
87
 
89
- it "finds a matching gem candidate version" do
90
- dep = Gem::Dependency.new("rspec", ">= 0")
91
- dep_installer = Gem::DependencyInstaller.new
92
- allow(@gem_env).to receive(:dependency_installer).and_return(dep_installer)
93
- latest = [[gemspec("rspec", Gem::Version.new("1.3.0")), "https://rubygems.org/"]]
94
- expect(dep_installer).to receive(:find_gems_with_sources).with(dep).and_return(latest)
95
- expect(@gem_env.candidate_version_from_remote(Gem::Dependency.new("rspec", ">= 0"))).to eq(Gem::Version.new("1.3.0"))
96
- end
88
+ context "new default rubygems behavior" do
89
+ before do
90
+ Chef::Config[:rubygems_cache_enabled] = false
91
+ end
97
92
 
98
- it "finds a matching gem candidate version on rubygems 2.0.0+" do
99
- dep = Gem::Dependency.new("rspec", ">= 0")
100
- dep_installer = Gem::DependencyInstaller.new
101
- allow(@gem_env).to receive(:dependency_installer).and_return(dep_installer)
102
- best_gem = double("best gem match", :spec => gemspec("rspec", Gem::Version.new("1.3.0")), :source => "https://rubygems.org")
103
- available_set = double("Gem::AvailableSet test double")
104
- expect(available_set).to receive(:pick_best!)
105
- expect(available_set).to receive(:set).and_return([best_gem])
106
- expect(dep_installer).to receive(:find_gems_with_sources).with(dep).and_return(available_set)
107
- expect(@gem_env.candidate_version_from_remote(Gem::Dependency.new("rspec", ">= 0"))).to eq(Gem::Version.new("1.3.0"))
93
+ it "finds a matching gem candidate version on rubygems 2.0.0+" do
94
+ dep = Gem::Dependency.new("rspec", ">= 0")
95
+ dep_installer = Gem::DependencyInstaller.new
96
+ allow(@gem_env).to receive(:dependency_installer).and_return(dep_installer)
97
+ expect(dep_installer).not_to receive(:find_gems_with_sources).with(dep).and_call_original
98
+ expect(@gem_env.candidate_version_from_remote(dep)).to be_kind_of(Gem::Version)
99
+ end
100
+
101
+ it "gives the candidate version as nil if none is found" do
102
+ dep = Gem::Dependency.new("lksdjflksdjflsdkfj", ">= 0")
103
+ dep_installer = Gem::DependencyInstaller.new
104
+ allow(@gem_env).to receive(:dependency_installer).and_return(dep_installer)
105
+ expect(dep_installer).not_to receive(:find_gems_with_sources).with(dep).and_call_original
106
+ expect(@gem_env.candidate_version_from_remote(dep)).to be_nil
107
+ end
108
+
109
+ it "finds a matching gem from a specific gemserver when explicit sources are given (to a server that doesn't respond to api requests)" do
110
+ dep = Gem::Dependency.new("rspec", ">= 0")
111
+ dep_installer = Gem::DependencyInstaller.new
112
+ allow(@gem_env).to receive(:dependency_installer).and_return(dep_installer)
113
+ expect(dep_installer).not_to receive(:find_gems_with_sources).with(dep).and_call_original
114
+ expect(@gem_env.candidate_version_from_remote(dep, "http://production.cf.rubygems.org")).to be_kind_of(Gem::Version)
115
+ end
108
116
  end
109
117
 
110
- it "gives the candidate version as nil if none is found" do
111
- dep = Gem::Dependency.new("rspec", ">= 0")
112
- latest = []
113
- dep_installer = Gem::DependencyInstaller.new
114
- allow(@gem_env).to receive(:dependency_installer).and_return(dep_installer)
115
- expect(dep_installer).to receive(:find_gems_with_sources).with(dep).and_return(latest)
116
- expect(@gem_env.candidate_version_from_remote(Gem::Dependency.new("rspec", ">= 0"))).to be_nil
118
+ context "old rubygems caching behavior" do
119
+ before do
120
+ Chef::Config[:rubygems_cache_enabled] = true
121
+ end
122
+
123
+ it "finds a matching gem candidate version on rubygems 2.0.0+" do
124
+ dep = Gem::Dependency.new("rspec", ">= 0")
125
+ expect(@gem_env.candidate_version_from_remote(dep)).to be_kind_of(Gem::Version)
126
+ end
127
+
128
+ it "gives the candidate version as nil if none is found" do
129
+ dep = Gem::Dependency.new("lksdjflksdjflsdkfj", ">= 0")
130
+ expect(@gem_env.candidate_version_from_remote(dep)).to be_nil
131
+ end
132
+
133
+ it "finds a matching gem from a specific gemserver when explicit sources are given" do
134
+ dep = Gem::Dependency.new("rspec", ">= 0")
135
+ expect(@gem_env.candidate_version_from_remote(dep, "http://production.cf.rubygems.org")).to be_kind_of(Gem::Version)
136
+ end
117
137
  end
118
138
 
119
139
  it "finds a matching candidate version from a .gem file when the path to the gem is supplied" do
@@ -122,17 +142,6 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
122
142
  expect(@gem_env.candidate_version_from_file(Gem::Dependency.new("chef-integration-test", ">= 0.2.0"), location)).to be_nil
123
143
  end
124
144
 
125
- it "finds a matching gem from a specific gemserver when explicit sources are given" do
126
- dep = Gem::Dependency.new("rspec", ">= 0")
127
- latest = [[gemspec("rspec", Gem::Version.new("1.3.0")), "https://rubygems.org/"]]
128
-
129
- expect(@gem_env).to receive(:with_gem_sources).with("http://gems.example.com").and_yield
130
- dep_installer = Gem::DependencyInstaller.new
131
- allow(@gem_env).to receive(:dependency_installer).and_return(dep_installer)
132
- expect(dep_installer).to receive(:find_gems_with_sources).with(dep).and_return(latest)
133
- expect(@gem_env.candidate_version_from_remote(Gem::Dependency.new("rspec", ">=0"), "http://gems.example.com")).to eq(Gem::Version.new("1.3.0"))
134
- end
135
-
136
145
  it "installs a gem with a hash of options for the dependency installer" do
137
146
  dep_installer = Gem::DependencyInstaller.new
138
147
  expect(@gem_env).to receive(:dependency_installer).with(:install_dir => "/foo/bar").and_return(dep_installer)
@@ -545,7 +554,6 @@ describe Chef::Provider::Package::Rubygems do
545
554
  expect(provider.candidate_version).to eq("0.1.0")
546
555
  end
547
556
  end
548
-
549
557
  end
550
558
 
551
559
  describe "when installing a gem" do
@@ -586,10 +594,9 @@ describe Chef::Provider::Package::Rubygems do
586
594
 
587
595
  context "when source is a path" do
588
596
  let(:source) { CHEF_SPEC_DATA + "/gems/chef-integration-test-0.1.0.gem" }
589
- let(:domain) { { domain: :local } }
590
597
 
591
598
  it "installs the gem from file via the gems api" do
592
- expect(provider.gem_env).to receive(:install).with(source, domain)
599
+ expect(provider.gem_env).to receive(:install).with(source)
593
600
  provider.run_action(:install)
594
601
  expect(new_resource).to be_updated_by_last_action
595
602
  end
@@ -597,11 +604,10 @@ describe Chef::Provider::Package::Rubygems do
597
604
 
598
605
  context "when the gem name is a file path and source is nil" do
599
606
  let(:gem_name) { CHEF_SPEC_DATA + "/gems/chef-integration-test-0.1.0.gem" }
600
- let(:domain) { { domain: :local } }
601
607
 
602
608
  it "installs the gem from file via the gems api" do
603
609
  expect(new_resource.source).to eq(gem_name)
604
- expect(provider.gem_env).to receive(:install).with(gem_name, domain)
610
+ expect(provider.gem_env).to receive(:install).with(gem_name)
605
611
  provider.run_action(:install)
606
612
  expect(new_resource).to be_updated_by_last_action
607
613
  end
@@ -122,6 +122,15 @@ describe Chef::Provider::Package::Windows::Exe do
122
122
  end
123
123
  end
124
124
 
125
+ context "When timeout value is passed" do
126
+ it "removes installed package and quotes uninstall string" do
127
+ new_resource.timeout = 300
128
+ allow(::File).to receive(:exist?).with("uninst_dir/uninst_file").and_return(true)
129
+ expect(provider).to receive(:shell_out!).with(/start \"\" \/wait \"uninst_dir\/uninst_file\" \/S \/NCRC & exit %%%%ERRORLEVEL%%%%/, :timeout => 300, :returns => [0])
130
+ provider.remove_package
131
+ end
132
+ end
133
+
125
134
  context "several packages installed with quoted uninstall strings" do
126
135
  let(:uninstall_hash) do
127
136
  [
@@ -312,7 +312,8 @@ describe Chef::Provider::Package::Yum do
312
312
  end
313
313
 
314
314
  context "when the package name isn't found" do
315
- let(:yum_cache) { double(
315
+ let(:yum_cache) do
316
+ double(
316
317
  "Chef::Provider::Yum::YumCache",
317
318
  :reload_installed => true,
318
319
  :reset => true,
@@ -322,7 +323,7 @@ describe Chef::Provider::Package::Yum do
322
323
  :version_available? => true,
323
324
  :disable_extra_repo_control => true
324
325
  )
325
- }
326
+ end
326
327
 
327
328
  before do
328
329
  allow(Chef::Provider::Package::Yum::YumCache).to receive(:instance).and_return(yum_cache)
@@ -1063,21 +1064,21 @@ describe Chef::Provider::Package::Yum::RPMVersion do
1063
1064
  end
1064
1065
 
1065
1066
  it "should raise an error unless passed 1 or 3 args" do
1066
- expect {
1067
+ expect do
1067
1068
  Chef::Provider::Package::Yum::RPMVersion.new()
1068
- }.to raise_error(ArgumentError)
1069
- expect {
1069
+ end.to raise_error(ArgumentError)
1070
+ expect do
1070
1071
  Chef::Provider::Package::Yum::RPMVersion.new("1:1.6.5-9.36.el5")
1071
- }.not_to raise_error
1072
- expect {
1072
+ end.not_to raise_error
1073
+ expect do
1073
1074
  Chef::Provider::Package::Yum::RPMVersion.new("1:1.6.5-9.36.el5", "extra")
1074
- }.to raise_error(ArgumentError)
1075
- expect {
1075
+ end.to raise_error(ArgumentError)
1076
+ expect do
1076
1077
  Chef::Provider::Package::Yum::RPMVersion.new("1", "1.6.5", "9.36.el5")
1077
- }.not_to raise_error
1078
- expect {
1078
+ end.not_to raise_error
1079
+ expect do
1079
1080
  Chef::Provider::Package::Yum::RPMVersion.new("1", "1.6.5", "9.36.el5", "extra")
1080
- }.to raise_error(ArgumentError)
1081
+ end.to raise_error(ArgumentError)
1081
1082
  end
1082
1083
 
1083
1084
  # thanks version_class_spec.rb!
@@ -1229,9 +1230,9 @@ describe Chef::Provider::Package::Yum::RPMPackage do
1229
1230
 
1230
1231
  it "should always have at least one provide, itself" do
1231
1232
  expect(@rpm.provides.size).to eq(1)
1232
- @rpm.provides[0].name == "testing"
1233
- @rpm.provides[0].version.evr == "1:1.6.5-9.36.el5"
1234
- @rpm.provides[0].flag == :==
1233
+ expect(@rpm.provides[0].name).to eql("testing")
1234
+ expect(@rpm.provides[0].version.evr).to eql("1:1.6.5-9.36.el5")
1235
+ expect(@rpm.provides[0].flag).to eql(:==)
1235
1236
  end
1236
1237
  end
1237
1238
 
@@ -1253,37 +1254,37 @@ describe Chef::Provider::Package::Yum::RPMPackage do
1253
1254
 
1254
1255
  it "should always have at least one provide, itself" do
1255
1256
  expect(@rpm.provides.size).to eq(1)
1256
- @rpm.provides[0].name == "testing"
1257
- @rpm.provides[0].version.evr == "1:1.6.5-9.36.el5"
1258
- @rpm.provides[0].flag == :==
1257
+ expect(@rpm.provides[0].name).to eql("testing")
1258
+ expect(@rpm.provides[0].version.evr).to eql("1:1.6.5-9.36.el5")
1259
+ expect(@rpm.provides[0].flag).to eql(:==)
1259
1260
  end
1260
1261
  end
1261
1262
 
1262
1263
  it "should raise an error unless passed 4 or 6 args" do
1263
- expect {
1264
+ expect do
1264
1265
  Chef::Provider::Package::Yum::RPMPackage.new()
1265
- }.to raise_error(ArgumentError)
1266
- expect {
1266
+ end.to raise_error(ArgumentError)
1267
+ expect do
1267
1268
  Chef::Provider::Package::Yum::RPMPackage.new("testing")
1268
- }.to raise_error(ArgumentError)
1269
- expect {
1269
+ end.to raise_error(ArgumentError)
1270
+ expect do
1270
1271
  Chef::Provider::Package::Yum::RPMPackage.new("testing", "1:1.6.5-9.36.el5")
1271
- }.to raise_error(ArgumentError)
1272
- expect {
1272
+ end.to raise_error(ArgumentError)
1273
+ expect do
1273
1274
  Chef::Provider::Package::Yum::RPMPackage.new("testing", "1:1.6.5-9.36.el5", "x86_64")
1274
- }.to raise_error(ArgumentError)
1275
- expect {
1275
+ end.to raise_error(ArgumentError)
1276
+ expect do
1276
1277
  Chef::Provider::Package::Yum::RPMPackage.new("testing", "1:1.6.5-9.36.el5", "x86_64", [])
1277
- }.not_to raise_error
1278
- expect {
1278
+ end.not_to raise_error
1279
+ expect do
1279
1280
  Chef::Provider::Package::Yum::RPMPackage.new("testing", "1", "1.6.5", "9.36.el5", "x86_64")
1280
- }.to raise_error(ArgumentError)
1281
- expect {
1281
+ end.to raise_error(ArgumentError)
1282
+ expect do
1282
1283
  Chef::Provider::Package::Yum::RPMPackage.new("testing", "1", "1.6.5", "9.36.el5", "x86_64", [])
1283
- }.not_to raise_error
1284
- expect {
1284
+ end.not_to raise_error
1285
+ expect do
1285
1286
  Chef::Provider::Package::Yum::RPMPackage.new("testing", "1", "1.6.5", "9.36.el5", "x86_64", [], "extra")
1286
- }.to raise_error(ArgumentError)
1287
+ end.to raise_error(ArgumentError)
1287
1288
  end
1288
1289
 
1289
1290
  describe "<=>" do
@@ -1397,27 +1398,27 @@ describe Chef::Provider::Package::Yum::RPMDependency do
1397
1398
  end
1398
1399
 
1399
1400
  it "should raise an error unless passed 3 or 5 args" do
1400
- expect {
1401
+ expect do
1401
1402
  Chef::Provider::Package::Yum::RPMDependency.new()
1402
- }.to raise_error(ArgumentError)
1403
- expect {
1403
+ end.to raise_error(ArgumentError)
1404
+ expect do
1404
1405
  Chef::Provider::Package::Yum::RPMDependency.new("testing")
1405
- }.to raise_error(ArgumentError)
1406
- expect {
1406
+ end.to raise_error(ArgumentError)
1407
+ expect do
1407
1408
  Chef::Provider::Package::Yum::RPMDependency.new("testing", "1:1.6.5-9.36.el5")
1408
- }.to raise_error(ArgumentError)
1409
- expect {
1409
+ end.to raise_error(ArgumentError)
1410
+ expect do
1410
1411
  Chef::Provider::Package::Yum::RPMDependency.new("testing", "1:1.6.5-9.36.el5", :==)
1411
- }.not_to raise_error
1412
- expect {
1412
+ end.not_to raise_error
1413
+ expect do
1413
1414
  Chef::Provider::Package::Yum::RPMDependency.new("testing", "1:1.6.5-9.36.el5", :==, "extra")
1414
- }.to raise_error(ArgumentError)
1415
- expect {
1415
+ end.to raise_error(ArgumentError)
1416
+ expect do
1416
1417
  Chef::Provider::Package::Yum::RPMDependency.new("testing", "1", "1.6.5", "9.36.el5", :==)
1417
- }.not_to raise_error
1418
- expect {
1418
+ end.not_to raise_error
1419
+ expect do
1419
1420
  Chef::Provider::Package::Yum::RPMDependency.new("testing", "1", "1.6.5", "9.36.el5", :==, "extra")
1420
- }.to raise_error(ArgumentError)
1421
+ end.to raise_error(ArgumentError)
1421
1422
  end
1422
1423
 
1423
1424
  describe "parse" do
@@ -1485,12 +1486,12 @@ describe Chef::Provider::Package::Yum::RPMDependency do
1485
1486
  it "should raise an error unless a RPMDependency is passed" do
1486
1487
  @rpmprovide = Chef::Provider::Package::Yum::RPMDependency.new("testing", "1:1.6.5-9.36.el5", :==)
1487
1488
  @rpmrequire = Chef::Provider::Package::Yum::RPMDependency.new("testing", "1:1.6.5-9.36.el5", :>=)
1488
- expect {
1489
+ expect do
1489
1490
  @rpmprovide.satisfy?("hi")
1490
- }.to raise_error(ArgumentError)
1491
- expect {
1491
+ end.to raise_error(ArgumentError)
1492
+ expect do
1492
1493
  @rpmprovide.satisfy?(@rpmrequire)
1493
- }.not_to raise_error
1494
+ end.not_to raise_error
1494
1495
  end
1495
1496
 
1496
1497
  it "should validate dependency satisfaction logic for standard examples" do
@@ -1712,12 +1713,12 @@ describe Chef::Provider::Package::Yum::RPMDb do
1712
1713
  it "should raise an error unless a RPMDependency is passed" do
1713
1714
  @rpmprovide = Chef::Provider::Package::Yum::RPMDependency.new("testing", "1:1.6.5-9.36.el5", :==)
1714
1715
  @rpmrequire = Chef::Provider::Package::Yum::RPMDependency.new("testing", "1:1.6.5-9.36.el5", :>=)
1715
- expect {
1716
+ expect do
1716
1717
  @rpmdb.whatprovides("hi")
1717
- }.to raise_error(ArgumentError)
1718
- expect {
1718
+ end.to raise_error(ArgumentError)
1719
+ expect do
1719
1720
  @rpmdb.whatprovides(@rpmrequire)
1720
- }.not_to raise_error
1721
+ end.not_to raise_error
1721
1722
  end
1722
1723
 
1723
1724
  it "should return an Array of packages statisfying a RPMDependency" do
@@ -1748,13 +1749,13 @@ describe Chef::Provider::Package::Yum::YumCache do
1748
1749
  end
1749
1750
  end
1750
1751
 
1751
- let(:yum_exe) {
1752
+ let(:yum_exe) do
1752
1753
  StringIO.new("#!/usr/bin/python\n\naldsjfa\ldsajflkdsjf\lajsdfj")
1753
- }
1754
+ end
1754
1755
 
1755
- let(:bin_exe) {
1756
+ let(:bin_exe) do
1756
1757
  StringIO.new(SecureRandom.random_bytes)
1757
- }
1758
+ end
1758
1759
 
1759
1760
  before(:each) do
1760
1761
  @stdin = double("STDIN", :nil_object => true)
@@ -396,13 +396,13 @@ describe Chef::Provider::Package do
396
396
 
397
397
  describe "when installing the preseed file to the cache location" do
398
398
  let(:response_file_destination) { Dir.tmpdir + "/preseed--java--java-6.seed" }
399
- let(:response_file_resource) {
399
+ let(:response_file_resource) do
400
400
  response_file_resource = Chef::Resource::CookbookFile.new(response_file_destination, run_context)
401
401
  response_file_resource.cookbook_name = "java"
402
402
  response_file_resource.backup(false)
403
403
  response_file_resource.source("java.response")
404
404
  response_file_resource
405
- }
405
+ end
406
406
 
407
407
  before do
408
408
  expect(provider).to receive(:preseed_resource).with("java", "6").and_return(response_file_resource)