chef 14.14.29-universal-mingw32 → 14.15.6-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (366) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +18 -7
  4. data/Rakefile +7 -4
  5. data/chef.gemspec +1 -1
  6. data/lib/chef/knife/ssh.rb +6 -0
  7. data/lib/chef/provider/ifconfig.rb +14 -5
  8. data/lib/chef/provider/windows_task.rb +9 -5
  9. data/lib/chef/resource/kernel_module.rb +61 -0
  10. data/lib/chef/resource/windows_task.rb +4 -0
  11. data/lib/chef/version.rb +1 -1
  12. data/spec/data/cookbooks/openldap/metadata.rb +2 -2
  13. data/spec/data/metadata/quick_start/metadata.rb +2 -7
  14. data/spec/functional/audit/runner_spec.rb +1 -1
  15. data/spec/functional/dsl/reboot_pending_spec.rb +7 -25
  16. data/spec/functional/event_loggers/windows_eventlog_spec.rb +6 -4
  17. data/spec/functional/file_content_management/deploy_strategies_spec.rb +21 -21
  18. data/spec/functional/knife/exec_spec.rb +1 -1
  19. data/spec/functional/knife/ssh_spec.rb +3 -3
  20. data/spec/functional/mixin/user_context_spec.rb +3 -1
  21. data/spec/functional/rebooter_spec.rb +1 -1
  22. data/spec/functional/resource/aix_service_spec.rb +1 -1
  23. data/spec/functional/resource/aixinit_service_spec.rb +1 -1
  24. data/spec/functional/resource/apt_package_spec.rb +1 -1
  25. data/spec/functional/resource/chocolatey_package_spec.rb +2 -2
  26. data/spec/functional/resource/cookbook_file_spec.rb +1 -3
  27. data/spec/functional/resource/cron_spec.rb +4 -3
  28. data/spec/functional/resource/dpkg_package_spec.rb +4 -4
  29. data/spec/functional/resource/dsc_resource_spec.rb +2 -1
  30. data/spec/functional/resource/dsc_script_spec.rb +16 -20
  31. data/spec/functional/resource/execute_spec.rb +2 -2
  32. data/spec/functional/resource/git_spec.rb +6 -6
  33. data/spec/functional/resource/group_spec.rb +8 -6
  34. data/spec/functional/resource/ifconfig_spec.rb +3 -5
  35. data/spec/functional/resource/link_spec.rb +2 -2
  36. data/spec/functional/resource/mount_spec.rb +3 -7
  37. data/spec/functional/resource/powershell_script_spec.rb +9 -8
  38. data/spec/functional/resource/reboot_spec.rb +1 -1
  39. data/spec/functional/resource/remote_file_spec.rb +2 -2
  40. data/spec/functional/resource/template_spec.rb +1 -1
  41. data/spec/functional/resource/user/windows_spec.rb +2 -2
  42. data/spec/functional/resource/windows_certificate_spec.rb +3 -3
  43. data/spec/functional/resource/windows_service_spec.rb +3 -3
  44. data/spec/functional/resource/windows_task_spec.rb +51 -0
  45. data/spec/functional/run_lock_spec.rb +10 -3
  46. data/spec/functional/shell_spec.rb +1 -1
  47. data/spec/functional/util/powershell/cmdlet_spec.rb +1 -1
  48. data/spec/functional/version_spec.rb +1 -1
  49. data/spec/functional/win32/security_spec.rb +12 -7
  50. data/spec/functional/win32/service_manager_spec.rb +1 -1
  51. data/spec/functional/win32/version_info_spec.rb +4 -4
  52. data/spec/integration/client/client_spec.rb +114 -132
  53. data/spec/integration/client/exit_code_spec.rb +8 -8
  54. data/spec/integration/client/ipv6_spec.rb +5 -5
  55. data/spec/integration/knife/chef_fs_data_store_spec.rb +38 -38
  56. data/spec/integration/knife/chef_repo_path_spec.rb +42 -42
  57. data/spec/integration/knife/chef_repository_file_system_spec.rb +9 -9
  58. data/spec/integration/knife/chefignore_spec.rb +13 -13
  59. data/spec/integration/knife/client_bulk_delete_spec.rb +8 -8
  60. data/spec/integration/knife/client_create_spec.rb +1 -1
  61. data/spec/integration/knife/client_delete_spec.rb +4 -4
  62. data/spec/integration/knife/client_key_delete_spec.rb +1 -1
  63. data/spec/integration/knife/client_key_list_spec.rb +1 -1
  64. data/spec/integration/knife/client_list_spec.rb +1 -1
  65. data/spec/integration/knife/common_options_spec.rb +1 -1
  66. data/spec/integration/knife/config_get_spec.rb +1 -1
  67. data/spec/integration/knife/config_list_profiles_spec.rb +2 -1
  68. data/spec/integration/knife/cookbook_api_ipv6_spec.rb +3 -3
  69. data/spec/integration/knife/cookbook_bulk_delete_spec.rb +3 -3
  70. data/spec/integration/knife/cookbook_download_spec.rb +4 -4
  71. data/spec/integration/knife/cookbook_list_spec.rb +2 -2
  72. data/spec/integration/knife/cookbook_show_spec.rb +3 -3
  73. data/spec/integration/knife/cookbook_upload_spec.rb +6 -6
  74. data/spec/integration/knife/data_bag_delete_spec.rb +4 -4
  75. data/spec/integration/knife/data_bag_from_file_spec.rb +7 -7
  76. data/spec/integration/knife/data_bag_list_spec.rb +1 -1
  77. data/spec/integration/knife/delete_spec.rb +37 -37
  78. data/spec/integration/knife/deps_spec.rb +23 -23
  79. data/spec/integration/knife/diff_spec.rb +23 -23
  80. data/spec/integration/knife/download_spec.rb +79 -79
  81. data/spec/integration/knife/environment_compare_spec.rb +3 -3
  82. data/spec/integration/knife/environment_from_file_spec.rb +6 -6
  83. data/spec/integration/knife/environment_list_spec.rb +1 -1
  84. data/spec/integration/knife/environment_show_spec.rb +4 -4
  85. data/spec/integration/knife/list_spec.rb +25 -25
  86. data/spec/integration/knife/node_bulk_delete_spec.rb +2 -2
  87. data/spec/integration/knife/node_delete_spec.rb +2 -2
  88. data/spec/integration/knife/node_environment_set_spec.rb +1 -1
  89. data/spec/integration/knife/node_from_file_spec.rb +2 -2
  90. data/spec/integration/knife/node_list_spec.rb +1 -1
  91. data/spec/integration/knife/raw_spec.rb +12 -12
  92. data/spec/integration/knife/redirection_spec.rb +1 -1
  93. data/spec/integration/knife/role_bulk_delete_spec.rb +2 -2
  94. data/spec/integration/knife/role_delete_spec.rb +2 -2
  95. data/spec/integration/knife/role_from_file_spec.rb +5 -5
  96. data/spec/integration/knife/role_list_spec.rb +1 -1
  97. data/spec/integration/knife/role_show_spec.rb +1 -1
  98. data/spec/integration/knife/show_spec.rb +10 -10
  99. data/spec/integration/knife/upload_spec.rb +85 -85
  100. data/spec/integration/recipes/accumulator_spec.rb +4 -4
  101. data/spec/integration/recipes/lwrp_inline_resources_spec.rb +6 -6
  102. data/spec/integration/recipes/lwrp_spec.rb +6 -6
  103. data/spec/integration/recipes/notifies_spec.rb +45 -45
  104. data/spec/integration/recipes/notifying_block_spec.rb +4 -4
  105. data/spec/integration/recipes/provider_choice.rb +1 -2
  106. data/spec/integration/recipes/recipe_dsl_spec.rb +9 -9
  107. data/spec/integration/recipes/remote_directory.rb +2 -2
  108. data/spec/integration/recipes/resource_action_spec.rb +1 -1
  109. data/spec/integration/recipes/resource_converge_if_changed_spec.rb +19 -19
  110. data/spec/integration/solo/solo_spec.rb +29 -29
  111. data/spec/scripts/ssl-serve.rb +1 -1
  112. data/spec/spec_helper.rb +11 -14
  113. data/spec/stress/win32/security_spec.rb +1 -1
  114. data/spec/support/lib/chef/resource/zen_follower.rb +1 -1
  115. data/spec/support/lib/chef/resource/zen_master.rb +1 -1
  116. data/spec/support/mock/platform.rb +2 -2
  117. data/spec/support/platform_helpers.rb +12 -3
  118. data/spec/support/platforms/win32/spec_service.rb +6 -10
  119. data/spec/support/shared/context/client.rb +2 -1
  120. data/spec/support/shared/functional/execute_resource.rb +4 -4
  121. data/spec/support/shared/functional/file_resource.rb +1 -3
  122. data/spec/support/shared/functional/http.rb +20 -44
  123. data/spec/support/shared/functional/securable_resource.rb +4 -8
  124. data/spec/support/shared/functional/win32_service.rb +1 -1
  125. data/spec/support/shared/functional/windows_script.rb +2 -1
  126. data/spec/support/shared/integration/app_server_support.rb +3 -4
  127. data/spec/support/shared/integration/integration_helper.rb +1 -0
  128. data/spec/support/shared/integration/knife_support.rb +5 -5
  129. data/spec/support/shared/unit/application_dot_d.rb +10 -4
  130. data/spec/support/shared/unit/file_system_support.rb +3 -2
  131. data/spec/support/shared/unit/platform_introspector.rb +12 -12
  132. data/spec/support/shared/unit/provider/file.rb +1 -1
  133. data/spec/support/shared/unit/script_resource.rb +1 -1
  134. data/spec/support/shared/unit/windows_script_resource.rb +1 -1
  135. data/spec/tiny_server.rb +1 -1
  136. data/spec/unit/api_client/registration_spec.rb +1 -1
  137. data/spec/unit/api_client_spec.rb +5 -5
  138. data/spec/unit/api_client_v1_spec.rb +6 -6
  139. data/spec/unit/application/client_spec.rb +8 -8
  140. data/spec/unit/application/exit_code_spec.rb +3 -2
  141. data/spec/unit/application/knife_spec.rb +1 -2
  142. data/spec/unit/audit/audit_event_proxy_spec.rb +14 -7
  143. data/spec/unit/audit/audit_reporter_spec.rb +20 -11
  144. data/spec/unit/audit/control_group_data_spec.rb +17 -12
  145. data/spec/unit/chef_fs/config_spec.rb +3 -3
  146. data/spec/unit/chef_fs/file_system/repository/directory_spec.rb +1 -1
  147. data/spec/unit/chef_fs/parallelizer.rb +1 -1
  148. data/spec/unit/client_spec.rb +3 -3
  149. data/spec/unit/config_fetcher_spec.rb +1 -1
  150. data/spec/unit/cookbook/metadata_spec.rb +13 -13
  151. data/spec/unit/cookbook/synchronizer_spec.rb +6 -6
  152. data/spec/unit/cookbook_loader_spec.rb +17 -17
  153. data/spec/unit/cookbook_manifest_spec.rb +9 -9
  154. data/spec/unit/cookbook_site_streaming_uploader_spec.rb +1 -2
  155. data/spec/unit/cookbook_uploader_spec.rb +2 -2
  156. data/spec/unit/cookbook_version_file_specificity_spec.rb +9 -9
  157. data/spec/unit/cookbook_version_spec.rb +2 -2
  158. data/spec/unit/data_bag_item_spec.rb +7 -7
  159. data/spec/unit/data_bag_spec.rb +1 -1
  160. data/spec/unit/data_collector_spec.rb +23 -23
  161. data/spec/unit/decorator_spec.rb +2 -2
  162. data/spec/unit/deprecated_spec.rb +2 -2
  163. data/spec/unit/dsl/data_query_spec.rb +3 -2
  164. data/spec/unit/dsl/declare_resource_spec.rb +1 -1
  165. data/spec/unit/dsl/platform_introspection_spec.rb +2 -2
  166. data/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb +2 -1
  167. data/spec/unit/encrypted_data_bag_item_spec.rb +2 -1
  168. data/spec/unit/environment_spec.rb +13 -13
  169. data/spec/unit/event_dispatch/dsl_spec.rb +1 -1
  170. data/spec/unit/file_content_management/deploy/mv_unix_spec.rb +3 -3
  171. data/spec/unit/file_content_management/deploy/mv_windows_spec.rb +2 -2
  172. data/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb +3 -3
  173. data/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb +1 -1
  174. data/spec/unit/http/authenticator_spec.rb +4 -3
  175. data/spec/unit/http/json_input_spec.rb +1 -1
  176. data/spec/unit/http/socketless_chef_zero_client_spec.rb +15 -15
  177. data/spec/unit/key_spec.rb +8 -8
  178. data/spec/unit/knife/bootstrap_spec.rb +14 -10
  179. data/spec/unit/knife/client_bulk_delete_spec.rb +4 -4
  180. data/spec/unit/knife/configure_client_spec.rb +1 -1
  181. data/spec/unit/knife/configure_spec.rb +1 -1
  182. data/spec/unit/knife/cookbook_bulk_delete_spec.rb +1 -1
  183. data/spec/unit/knife/cookbook_delete_spec.rb +2 -2
  184. data/spec/unit/knife/cookbook_download_spec.rb +2 -2
  185. data/spec/unit/knife/cookbook_metadata_spec.rb +4 -4
  186. data/spec/unit/knife/cookbook_upload_spec.rb +7 -5
  187. data/spec/unit/knife/core/bootstrap_context_spec.rb +1 -1
  188. data/spec/unit/knife/core/cookbook_scm_repo_spec.rb +2 -2
  189. data/spec/unit/knife/core/gem_glob_loader_spec.rb +4 -4
  190. data/spec/unit/knife/core/hashed_command_loader_spec.rb +4 -2
  191. data/spec/unit/knife/core/node_editor_spec.rb +12 -12
  192. data/spec/unit/knife/core/ui_spec.rb +11 -11
  193. data/spec/unit/knife/data_bag_from_file_spec.rb +2 -1
  194. data/spec/unit/knife/data_bag_show_spec.rb +2 -1
  195. data/spec/unit/knife/key_create_spec.rb +1 -1
  196. data/spec/unit/knife/key_delete_spec.rb +3 -3
  197. data/spec/unit/knife/key_edit_spec.rb +4 -4
  198. data/spec/unit/knife/key_list_spec.rb +1 -1
  199. data/spec/unit/knife/key_show_spec.rb +3 -3
  200. data/spec/unit/knife/node_bulk_delete_spec.rb +3 -3
  201. data/spec/unit/knife/node_delete_spec.rb +2 -2
  202. data/spec/unit/knife/node_edit_spec.rb +1 -1
  203. data/spec/unit/knife/node_environment_set_spec.rb +1 -1
  204. data/spec/unit/knife/node_from_file_spec.rb +1 -1
  205. data/spec/unit/knife/node_policy_set_spec.rb +1 -1
  206. data/spec/unit/knife/node_run_list_add_spec.rb +1 -1
  207. data/spec/unit/knife/node_run_list_remove_spec.rb +1 -1
  208. data/spec/unit/knife/node_run_list_set_spec.rb +1 -1
  209. data/spec/unit/knife/node_show_spec.rb +1 -1
  210. data/spec/unit/knife/raw_spec.rb +2 -2
  211. data/spec/unit/knife/role_bulk_delete_spec.rb +2 -2
  212. data/spec/unit/knife/role_create_spec.rb +1 -1
  213. data/spec/unit/knife/role_delete_spec.rb +1 -1
  214. data/spec/unit/knife/role_edit_spec.rb +1 -1
  215. data/spec/unit/knife/role_env_run_list_add_spec.rb +1 -1
  216. data/spec/unit/knife/role_env_run_list_clear_spec.rb +1 -1
  217. data/spec/unit/knife/role_env_run_list_remove_spec.rb +1 -1
  218. data/spec/unit/knife/role_env_run_list_replace_spec.rb +1 -1
  219. data/spec/unit/knife/role_env_run_list_set_spec.rb +1 -1
  220. data/spec/unit/knife/role_from_file_spec.rb +1 -1
  221. data/spec/unit/knife/role_run_list_add_spec.rb +1 -1
  222. data/spec/unit/knife/role_run_list_clear_spec.rb +1 -1
  223. data/spec/unit/knife/role_run_list_remove_spec.rb +1 -1
  224. data/spec/unit/knife/role_run_list_replace_spec.rb +1 -1
  225. data/spec/unit/knife/role_run_list_set_spec.rb +1 -1
  226. data/spec/unit/knife/ssh_spec.rb +27 -17
  227. data/spec/unit/knife/ssl_check_spec.rb +4 -4
  228. data/spec/unit/knife/ssl_fetch_spec.rb +5 -5
  229. data/spec/unit/knife/status_spec.rb +3 -2
  230. data/spec/unit/knife/supermarket_download_spec.rb +4 -4
  231. data/spec/unit/knife/supermarket_install_spec.rb +5 -4
  232. data/spec/unit/knife/supermarket_share_spec.rb +1 -1
  233. data/spec/unit/knife_spec.rb +34 -33
  234. data/spec/unit/lwrp_spec.rb +19 -19
  235. data/spec/unit/mixin/homebrew_user_spec.rb +1 -1
  236. data/spec/unit/mixin/params_validate_spec.rb +10 -10
  237. data/spec/unit/mixin/properties_spec.rb +4 -4
  238. data/spec/unit/mixin/shell_out_spec.rb +27 -27
  239. data/spec/unit/mixin/template_spec.rb +4 -8
  240. data/spec/unit/mixin/unformatter_spec.rb +1 -2
  241. data/spec/unit/mixin/user_context_spec.rb +1 -2
  242. data/spec/unit/mixin/which.rb +2 -0
  243. data/spec/unit/mixin/windows_architecture_helper_spec.rb +3 -3
  244. data/spec/unit/node/attribute_spec.rb +79 -79
  245. data/spec/unit/node/immutable_collections_spec.rb +50 -50
  246. data/spec/unit/node_spec.rb +16 -16
  247. data/spec/unit/org_spec.rb +3 -3
  248. data/spec/unit/policy_builder/policyfile_spec.rb +2 -2
  249. data/spec/unit/property/state_spec.rb +26 -25
  250. data/spec/unit/property/validation_spec.rb +14 -13
  251. data/spec/unit/property_spec.rb +10 -9
  252. data/spec/unit/provider/apt_update_spec.rb +6 -6
  253. data/spec/unit/provider/cron_spec.rb +15 -15
  254. data/spec/unit/provider/dsc_resource_spec.rb +6 -3
  255. data/spec/unit/provider/dsc_script_spec.rb +1 -1
  256. data/spec/unit/provider/execute_spec.rb +5 -5
  257. data/spec/unit/provider/git_spec.rb +39 -39
  258. data/spec/unit/provider/group/dscl_spec.rb +3 -3
  259. data/spec/unit/provider/group/groupadd_spec.rb +1 -1
  260. data/spec/unit/provider/group_spec.rb +2 -3
  261. data/spec/unit/provider/ifconfig/aix_spec.rb +1 -1
  262. data/spec/unit/provider/ifconfig/debian_spec.rb +2 -2
  263. data/spec/unit/provider/ifconfig_spec.rb +45 -16
  264. data/spec/unit/provider/launchd_spec.rb +23 -15
  265. data/spec/unit/provider/link_spec.rb +22 -11
  266. data/spec/unit/provider/mount/aix_spec.rb +6 -6
  267. data/spec/unit/provider/mount/mount_spec.rb +31 -31
  268. data/spec/unit/provider/mount/solaris_spec.rb +11 -11
  269. data/spec/unit/provider/ohai_spec.rb +1 -1
  270. data/spec/unit/provider/osx_profile_spec.rb +5 -7
  271. data/spec/unit/provider/package/apt_spec.rb +5 -5
  272. data/spec/unit/provider/package/bff_spec.rb +1 -1
  273. data/spec/unit/provider/package/cab_spec.rb +1 -1
  274. data/spec/unit/provider/package/chocolatey_spec.rb +8 -8
  275. data/spec/unit/provider/package/freebsd/pkg_spec.rb +1 -1
  276. data/spec/unit/provider/package/ips_spec.rb +6 -6
  277. data/spec/unit/provider/package/macports_spec.rb +1 -1
  278. data/spec/unit/provider/package/msu_spec.rb +1 -1
  279. data/spec/unit/provider/package/openbsd_spec.rb +15 -11
  280. data/spec/unit/provider/package/pacman_spec.rb +3 -3
  281. data/spec/unit/provider/package/paludis_spec.rb +4 -4
  282. data/spec/unit/provider/package/portage_spec.rb +1 -1
  283. data/spec/unit/provider/package/powershell_spec.rb +1 -1
  284. data/spec/unit/provider/package/smartos_spec.rb +3 -3
  285. data/spec/unit/provider/package/solaris_spec.rb +1 -1
  286. data/spec/unit/provider/package/windows/exe_spec.rb +9 -9
  287. data/spec/unit/provider/package/windows/msi_spec.rb +7 -7
  288. data/spec/unit/provider/package/windows_spec.rb +2 -1
  289. data/spec/unit/provider/package/yum/yum_cache_spec.rb +1 -1
  290. data/spec/unit/provider/package/zypper_spec.rb +4 -4
  291. data/spec/unit/provider/package_spec.rb +1 -1
  292. data/spec/unit/provider/powershell_script_spec.rb +7 -7
  293. data/spec/unit/provider/registry_key_spec.rb +1 -1
  294. data/spec/unit/provider/remote_directory_spec.rb +6 -6
  295. data/spec/unit/provider/route_spec.rb +11 -11
  296. data/spec/unit/provider/service/arch_service_spec.rb +13 -13
  297. data/spec/unit/provider/service/debian_service_spec.rb +2 -1
  298. data/spec/unit/provider/service/freebsd_service_spec.rb +28 -24
  299. data/spec/unit/provider/service/gentoo_service_spec.rb +2 -2
  300. data/spec/unit/provider/service/init_service_spec.rb +11 -11
  301. data/spec/unit/provider/service/invokercd_service_spec.rb +11 -11
  302. data/spec/unit/provider/service/macosx_spec.rb +5 -5
  303. data/spec/unit/provider/service/openbsd_service_spec.rb +15 -11
  304. data/spec/unit/provider/service/simple_service_spec.rb +7 -7
  305. data/spec/unit/provider/service/upstart_service_spec.rb +14 -14
  306. data/spec/unit/provider/service/windows_spec.rb +53 -35
  307. data/spec/unit/provider/subversion_spec.rb +8 -4
  308. data/spec/unit/provider/systemd_unit_spec.rb +142 -142
  309. data/spec/unit/provider/template/content_spec.rb +29 -29
  310. data/spec/unit/provider/windows_task_spec.rb +1 -1
  311. data/spec/unit/provider_resolver_spec.rb +75 -75
  312. data/spec/unit/provider_spec.rb +2 -4
  313. data/spec/unit/recipe_spec.rb +4 -4
  314. data/spec/unit/resource/batch_spec.rb +1 -1
  315. data/spec/unit/resource/chef_gem_spec.rb +1 -1
  316. data/spec/unit/resource/chocolatey_config_spec.rb +1 -1
  317. data/spec/unit/resource/chocolatey_source_spec.rb +1 -1
  318. data/spec/unit/resource/directory_spec.rb +1 -1
  319. data/spec/unit/resource/dnf_package_spec.rb +1 -1
  320. data/spec/unit/resource/dsc_resource_spec.rb +1 -1
  321. data/spec/unit/resource/file/verification_spec.rb +1 -2
  322. data/spec/unit/resource/file_spec.rb +1 -1
  323. data/spec/unit/resource/group_spec.rb +1 -1
  324. data/spec/unit/resource/link_spec.rb +1 -1
  325. data/spec/unit/resource/osx_profile_spec.rb +2 -1
  326. data/spec/unit/resource/powershell_script_spec.rb +12 -7
  327. data/spec/unit/resource/registry_key_spec.rb +3 -3
  328. data/spec/unit/resource/rhsm_subscription_spec.rb +1 -1
  329. data/spec/unit/resource/service_spec.rb +1 -1
  330. data/spec/unit/resource/template_spec.rb +2 -2
  331. data/spec/unit/resource/windows_env_spec.rb +1 -1
  332. data/spec/unit/resource/windows_service_spec.rb +5 -5
  333. data/spec/unit/resource/windows_task_spec.rb +6 -2
  334. data/spec/unit/resource/yum_package_spec.rb +1 -1
  335. data/spec/unit/resource_collection/resource_list_spec.rb +1 -1
  336. data/spec/unit/resource_collection/resource_set_spec.rb +7 -7
  337. data/spec/unit/resource_collection/stepable_iterator_spec.rb +2 -2
  338. data/spec/unit/resource_collection_spec.rb +4 -4
  339. data/spec/unit/resource_definition_spec.rb +2 -2
  340. data/spec/unit/resource_inspector_spec.rb +1 -1
  341. data/spec/unit/resource_reporter_spec.rb +4 -4
  342. data/spec/unit/resource_spec.rb +22 -22
  343. data/spec/unit/role_spec.rb +3 -3
  344. data/spec/unit/run_context/cookbook_compiler_spec.rb +23 -23
  345. data/spec/unit/run_list/run_list_expansion_spec.rb +9 -6
  346. data/spec/unit/run_list_spec.rb +1 -1
  347. data/spec/unit/runner_spec.rb +3 -3
  348. data/spec/unit/search/query_spec.rb +3 -2
  349. data/spec/unit/shell/model_wrapper_spec.rb +1 -1
  350. data/spec/unit/shell/shell_session_spec.rb +8 -11
  351. data/spec/unit/shell_spec.rb +1 -2
  352. data/spec/unit/user_spec.rb +4 -4
  353. data/spec/unit/user_v1_spec.rb +3 -3
  354. data/spec/unit/util/backup_spec.rb +1 -1
  355. data/spec/unit/util/dsc/lcm_output_parser_spec.rb +13 -13
  356. data/spec/unit/util/dsc/local_configuration_manager_spec.rb +3 -3
  357. data/spec/unit/util/editor_spec.rb +1 -1
  358. data/spec/unit/util/powershell/ps_credential_spec.rb +3 -2
  359. data/spec/unit/util/threaded_job_queue_spec.rb +2 -2
  360. data/spec/unit/version_class_spec.rb +4 -4
  361. data/spec/unit/win32/registry_spec.rb +5 -5
  362. data/spec/unit/win32/security_spec.rb +2 -1
  363. data/tasks/announce.rb +4 -11
  364. metadata +10 -6
  365. data/tasks/maintainers.rb +0 -211
  366. data/tasks/templates/prerelease.md.erb +0 -35
@@ -133,9 +133,9 @@ describe Chef::Resource::Link do
133
133
  end
134
134
 
135
135
  def get_sid(value)
136
- if value.kind_of?(String)
136
+ if value.is_a?(String)
137
137
  Chef::ReservedNames::Win32::Security::SID.from_account(value)
138
- elsif value.kind_of?(Chef::ReservedNames::Win32::Security::SID)
138
+ elsif value.is_a?(Chef::ReservedNames::Win32::Security::SID)
139
139
  value
140
140
  else
141
141
  raise "Must specify username or SID: #{value}"
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
3
- # Copyright:: Copyright 2013-2018, Chef Software Inc.
3
+ # Copyright:: Copyright 2013-2019, Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -24,14 +24,10 @@ require "tmpdir"
24
24
  # run this test only for following platforms.
25
25
  include_flag = !(%w{debian rhel amazon aix solaris2}.include?(ohai[:platform_family]))
26
26
 
27
- describe Chef::Resource::Mount, :requires_root, :skip_travis, external: include_flag do
28
- # Disabled in travis because it refuses to let us mount a ramdisk. /dev/ramX does not
29
- # exist even after loading the kernel module
30
-
27
+ describe Chef::Resource::Mount, :requires_root, external: include_flag do
31
28
  include Chef::Mixin::ShellOut
32
29
 
33
30
  # Platform specific setup, cleanup and validation helpers.
34
-
35
31
  def setup_device_for_mount
36
32
  # use ramdisk for creating a test device for mount.
37
33
  # This can cleaner if we have chef resource/provider for ramdisk.
@@ -73,7 +69,7 @@ describe Chef::Resource::Mount, :requires_root, :skip_travis, external: include_
73
69
  def mount_should_exist(mount_point, device, fstype = nil, options = nil)
74
70
  validation_cmd = "mount | grep #{mount_point} | grep #{device} "
75
71
  validation_cmd << " | grep #{fstype} " unless fstype.nil?
76
- validation_cmd << " | grep #{options.join(',')} " unless options.nil? || options.empty?
72
+ validation_cmd << " | grep #{options.join(",")} " unless options.nil? || options.empty?
77
73
  expect(shell_out(validation_cmd).exitstatus).to eq(0)
78
74
  end
79
75
 
@@ -28,13 +28,13 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
28
28
 
29
29
  it_behaves_like "a Windows script running on Windows"
30
30
 
31
- let(:successful_executable_script_content) { "#{ENV['SystemRoot']}\\system32\\attrib.exe $env:systemroot" }
32
- let(:failed_executable_script_content) { "#{ENV['SystemRoot']}\\system32\\attrib.exe /badargument" }
31
+ let(:successful_executable_script_content) { "#{ENV["SystemRoot"]}\\system32\\attrib.exe $env:systemroot" }
32
+ let(:failed_executable_script_content) { "#{ENV["SystemRoot"]}\\system32\\attrib.exe /badargument" }
33
33
  let(:processor_architecture_script_content) { "echo $env:PROCESSOR_ARCHITECTURE" }
34
34
  let(:native_architecture_script_content) { "echo $env:PROCESSOR_ARCHITECTUREW6432" }
35
35
  let(:cmdlet_exit_code_not_found_content) { "get-item '.\\thisdoesnotexist'" }
36
36
  let(:cmdlet_exit_code_success_content) { "get-item ." }
37
- let(:windows_process_exit_code_success_content) { "#{ENV['SystemRoot']}\\system32\\attrib.exe $env:systemroot" }
37
+ let(:windows_process_exit_code_success_content) { "#{ENV["SystemRoot"]}\\system32\\attrib.exe $env:systemroot" }
38
38
  let(:windows_process_exit_code_not_found_content) { "findstr /notavalidswitch" }
39
39
  let(:arbitrary_nonzero_process_exit_code) { 4193 }
40
40
  let(:arbitrary_nonzero_process_exit_code_content) { "exit #{arbitrary_nonzero_process_exit_code}" }
@@ -473,26 +473,26 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
473
473
  end
474
474
 
475
475
  it "evaluates a not_if block using the cwd guard parameter" do
476
- custom_cwd = "#{ENV['SystemRoot']}\\system32\\drivers\\etc"
476
+ custom_cwd = "#{ENV["SystemRoot"]}\\system32\\drivers\\etc"
477
477
  resource.not_if "exit ! [int32]($pwd.path -eq '#{custom_cwd}')", cwd: custom_cwd
478
478
  expect(resource.should_skip?(:run)).to be_truthy
479
479
  end
480
480
 
481
481
  it "evaluates an only_if block using the cwd guard parameter" do
482
- custom_cwd = "#{ENV['SystemRoot']}\\system32\\drivers\\etc"
482
+ custom_cwd = "#{ENV["SystemRoot"]}\\system32\\drivers\\etc"
483
483
  resource.only_if "exit ! [int32]($pwd.path -eq '#{custom_cwd}')", cwd: custom_cwd
484
484
  expect(resource.should_skip?(:run)).to be_falsey
485
485
  end
486
486
 
487
487
  it "inherits cwd from the parent resource for only_if" do
488
- custom_cwd = "#{ENV['SystemRoot']}\\system32\\drivers\\etc"
488
+ custom_cwd = "#{ENV["SystemRoot"]}\\system32\\drivers\\etc"
489
489
  resource.cwd custom_cwd
490
490
  resource.only_if "exit ! [int32]($pwd.path -eq '#{custom_cwd}')"
491
491
  expect(resource.should_skip?(:run)).to be_falsey
492
492
  end
493
493
 
494
494
  it "inherits cwd from the parent resource for not_if" do
495
- custom_cwd = "#{ENV['SystemRoot']}\\system32\\drivers\\etc"
495
+ custom_cwd = "#{ENV["SystemRoot"]}\\system32\\drivers\\etc"
496
496
  resource.cwd custom_cwd
497
497
  resource.not_if "exit ! [int32]($pwd.path -eq '#{custom_cwd}')"
498
498
  expect(resource.should_skip?(:run)).to be_truthy
@@ -584,7 +584,8 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
584
584
  resource.only_if "$true", architecture: :i386
585
585
  expect { resource.run_action(:run) }.to raise_error(
586
586
  Chef::Exceptions::Win32ArchitectureIncorrect,
587
- /cannot execute script with requested architecture 'i386' on Windows Nano Server/)
587
+ /cannot execute script with requested architecture 'i386' on Windows Nano Server/
588
+ )
588
589
  end
589
590
  end
590
591
  end
@@ -45,7 +45,7 @@ describe Chef::Resource::Reboot do
45
45
  shared_context "testing run context modification" do
46
46
  def test_reboot_action(resource)
47
47
  reboot_info = resource.run_context.reboot_info
48
- expect(reboot_info.keys.sort).to eq([:delay_mins, :reason, :requested_by, :timestamp])
48
+ expect(reboot_info.keys.sort).to eq(%i{delay_mins reason requested_by timestamp})
49
49
  expect(reboot_info[:delay_mins]).to eq(expected[:delay_mins])
50
50
  expect(reboot_info[:reason]).to eq(expected[:reason])
51
51
  expect(reboot_info[:requested_by]).to eq(expected[:requested_by])
@@ -134,7 +134,7 @@ describe Chef::Resource::RemoteFile do
134
134
  let(:smb_file_local_file_name) { "smb_file.txt" }
135
135
  let(:smb_file_local_path) { File.join( smb_share_root_directory, smb_file_local_file_name ) }
136
136
  let(:smb_share_name) { "chef_smb_test" }
137
- let(:smb_remote_path) { File.join("//#{ENV['COMPUTERNAME']}", smb_share_name, smb_file_local_file_name).gsub(/\//, "\\") }
137
+ let(:smb_remote_path) { File.join("//#{ENV["COMPUTERNAME"]}", smb_share_name, smb_file_local_file_name).gsub(%r{/}, "\\") }
138
138
  let(:smb_file_content) { "hellofun" }
139
139
  let(:local_destination_path) { File.join(Dir.tmpdir, make_tmpname("chef_remote_file")) }
140
140
  let(:windows_current_user) { ENV["USERNAME"] }
@@ -155,7 +155,7 @@ describe Chef::Resource::RemoteFile do
155
155
  before do
156
156
  shell_out("net.exe share #{smb_share_name} /delete")
157
157
  File.write(smb_file_local_path, smb_file_content )
158
- shell_out!("net.exe share #{smb_share_name}=\"#{smb_share_root_directory.gsub(/\//, '\\')}\" /grant:\"authenticated users\",read")
158
+ shell_out!("net.exe share #{smb_share_name}=\"#{smb_share_root_directory.gsub(%r{/}, '\\')}\" /grant:\"authenticated users\",read")
159
159
  end
160
160
 
161
161
  after do
@@ -21,7 +21,7 @@ require "spec_helper"
21
21
  describe Chef::Resource::Template do
22
22
 
23
23
  def binread(file)
24
- File.open(file, "rb") { |f| f.read }
24
+ File.open(file, "rb", &:read)
25
25
  end
26
26
 
27
27
  include_context Chef::Resource::File
@@ -47,13 +47,13 @@ describe Chef::Provider::User::Windows, :windows_only do
47
47
  end
48
48
 
49
49
  def backup_secedit_policy
50
- backup_command = "secedit /export /cfg #{ENV['TEMP']}\\secedit_restore.inf /areas SECURITYPOLICY"
50
+ backup_command = "secedit /export /cfg #{ENV["TEMP"]}\\secedit_restore.inf /areas SECURITYPOLICY"
51
51
  shell_out(backup_command)
52
52
  end
53
53
 
54
54
  def restore_secedit_policy
55
55
  security_database = "C:\\windows\\security\\database\\seceditnew.sdb"
56
- restore_command = "secedit /configure /db #{security_database} /cfg #{ENV['TEMP']}\\secedit_restore.inf /areas SECURITYPOLICY"
56
+ restore_command = "secedit /configure /db #{security_database} /cfg #{ENV["TEMP"]}\\secedit_restore.inf /areas SECURITYPOLICY"
57
57
  shell_out(restore_command)
58
58
  end
59
59
 
@@ -81,9 +81,9 @@ describe Chef::Resource::WindowsCertificate, :windows_only, :appveyor_only do
81
81
 
82
82
  # Byepassing the validation so that we may create a custom store
83
83
  allow_any_instance_of(Chef::Mixin::ParamsValidate)
84
- .to receive(:_pv_equal_to)
85
- .with(opts, key, to_be)
86
- .and_return(true)
84
+ .to receive(:_pv_equal_to)
85
+ .with(opts, key, to_be)
86
+ .and_return(true)
87
87
 
88
88
  # Creating a custom store for the testing
89
89
  create_store(store)
@@ -24,7 +24,7 @@ describe Chef::Resource::WindowsService, :windows_only, :system_windows_service_
24
24
  include_context "using Win32::Service"
25
25
 
26
26
  let(:username) { "service_spec_user" }
27
- let(:qualified_username) { "#{ENV['COMPUTERNAME']}\\#{username}" }
27
+ let(:qualified_username) { "#{ENV["COMPUTERNAME"]}\\#{username}" }
28
28
  let(:password) { "1a2b3c4X!&narf" }
29
29
 
30
30
  let(:user_resource) do
@@ -36,7 +36,7 @@ describe Chef::Resource::WindowsService, :windows_only, :system_windows_service_
36
36
  end
37
37
 
38
38
  let(:global_service_file_path) do
39
- "#{ENV['WINDIR']}\\temp\\#{File.basename(test_service[:service_file_path])}"
39
+ "#{ENV["WINDIR"]}\\temp\\#{File.basename(test_service[:service_file_path])}"
40
40
  end
41
41
 
42
42
  let(:service_params) do
@@ -59,7 +59,7 @@ describe Chef::Resource::WindowsService, :windows_only, :system_windows_service_
59
59
 
60
60
  let(:service_resource) do
61
61
  r = Chef::Resource::WindowsService.new(service_params[:service_name], run_context)
62
- [:run_as_user, :run_as_password].each { |prop| r.send(prop, service_params[prop]) }
62
+ %i{run_as_user run_as_password}.each { |prop| r.send(prop, service_params[prop]) }
63
63
  r
64
64
  end
65
65
 
@@ -1283,6 +1283,57 @@ describe Chef::Resource::WindowsTask, :windows_only do
1283
1283
  expect(subject).not_to be_updated_by_last_action
1284
1284
  end
1285
1285
  end
1286
+
1287
+ context "when start_when_available is passed" do
1288
+ subject do
1289
+ new_resource = Chef::Resource::WindowsTask.new(task_name, run_context)
1290
+ new_resource.command task_name
1291
+ new_resource.run_level :highest
1292
+ new_resource.execution_time_limit = 259200 / 60 # converting "PT72H" into minutes and passing here since win32-taskscheduler accespts this
1293
+ new_resource
1294
+ end
1295
+
1296
+ it "sets start_when_available to true" do
1297
+ subject.frequency :minute
1298
+ subject.start_when_available true
1299
+ call_for_create_action
1300
+ # loading current resource again to check new task is creted and it matches task parameters
1301
+ current_resource = call_for_load_current_resource
1302
+ expect(current_resource.exists).to eq(true)
1303
+ expect(current_resource.task.settings[:start_when_available]).to eql(true)
1304
+ end
1305
+
1306
+ it "sets start_when_available to false" do
1307
+ subject.frequency :minute
1308
+ subject.start_when_available false
1309
+ call_for_create_action
1310
+ # loading current resource again to check new task is created and it matches task parameters
1311
+ current_resource = call_for_load_current_resource
1312
+ expect(current_resource.exists).to eq(true)
1313
+ expect(current_resource.task.settings[:start_when_available]).to eql(false)
1314
+ end
1315
+
1316
+ it "sets the default if start_when_available is nil" do
1317
+ subject.frequency :minute
1318
+ subject.start_when_available nil
1319
+ call_for_create_action
1320
+ # loading current resource again to check new task is created and it matches task parameters
1321
+ current_resource = call_for_load_current_resource
1322
+ expect(current_resource.exists).to eq(true)
1323
+ expect(current_resource.task.settings[:start_when_available]).to eql(false)
1324
+ end
1325
+
1326
+ it "does not converge the resource if it is already converged" do
1327
+ subject.frequency :minute
1328
+ subject.start_when_available true
1329
+ subject.run_action(:create)
1330
+ subject.frequency :minute
1331
+ subject.start_when_available true
1332
+ subject.disallow_start_if_on_batteries false
1333
+ subject.run_action(:create)
1334
+ expect(subject).not_to be_updated_by_last_action
1335
+ end
1336
+ end
1286
1337
  end
1287
1338
 
1288
1339
  context "task_name with parent folder" do
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Daniel DeLeo (<dan@chef.io>)
3
- # Copyright:: Copyright 2012-2016, Chef Software, Inc.
3
+ # Copyright:: Copyright 2012-2020, Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -334,6 +334,7 @@ describe Chef::RunLock do
334
334
  loop do
335
335
  line = readline_nonblock(read_from_process)
336
336
  break if line.nil?
337
+
337
338
  event, time = line.split("@")
338
339
  example.log_event("#{name}.last_event got #{event}")
339
340
  example.log_event("[#{name}] #{event}", time.strip)
@@ -346,7 +347,7 @@ describe Chef::RunLock do
346
347
  example.log_event("#{name}.run_to(#{to_event.inspect})")
347
348
 
348
349
  # Start the process if it's not started
349
- start if !pid
350
+ start unless pid
350
351
 
351
352
  # Tell the process what to stop at (also means it can go)
352
353
  write_to_process.print "#{to_event}\n"
@@ -370,7 +371,7 @@ describe Chef::RunLock do
370
371
  def run_to_completion
371
372
  example.log_event("#{name}.run_to_completion")
372
373
  # Start the process if it's not started
373
- start if !pid
374
+ start unless pid
374
375
 
375
376
  # Tell the process to stop at nothing (no blocking)
376
377
  @write_to_process.print "nothing\n"
@@ -403,6 +404,12 @@ describe Chef::RunLock do
403
404
  example.log_event("#{name}.stop finished (pid #{pid} wasn't running)")
404
405
  end
405
406
  end
407
+
408
+ # close the IO.pipes so we don't leak them as open filehandles
409
+ @read_from_process.close rescue nil
410
+ @write_to_tests.close rescue nil
411
+ @read_from_tests.close rescue nil
412
+ @write_to_process.close rescue nil
406
413
  end
407
414
 
408
415
  def fire_event(event)
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Daniel DeLeo (<dan@chef.io>)
3
- # Copyright:: Copyright 2012-2017, Chef Software Inc.
3
+ # Copyright:: Copyright 2012-2019, Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -29,7 +29,7 @@ describe Chef::Util::Powershell::Cmdlet, :windows_powershell_dsc_only do
29
29
  let(:invalid_cmdlet) { Chef::Util::Powershell::Cmdlet.new(@node, "get-idontexist", cmd_output_format) }
30
30
  let(:cmdlet_get_item_requires_switch_or_argument) { Chef::Util::Powershell::Cmdlet.new(@node, "get-item", cmd_output_format, { depth: 2 }) }
31
31
  let(:cmdlet_alias_requires_switch_or_argument) { Chef::Util::Powershell::Cmdlet.new(@node, "alias", cmd_output_format, { depth: 2 }) }
32
- let(:etc_directory) { "#{ENV['systemroot']}\\system32\\drivers\\etc" }
32
+ let(:etc_directory) { "#{ENV["systemroot"]}\\system32\\drivers\\etc" }
33
33
  let(:architecture_cmdlet) { Chef::Util::Powershell::Cmdlet.new(@node, "$env:PROCESSOR_ARCHITECTURE") }
34
34
 
35
35
  it "executes a simple process" do
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Serdar Sutay (<dan@chef.io>)
3
- # Copyright:: Copyright 2013-2016, Chef Software Inc.
3
+ # Copyright:: Copyright 2013-2019, Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -61,7 +61,8 @@ describe "Chef::Win32::Security", :windows_only do
61
61
  describe "get_file_security" do
62
62
  it "should return a security descriptor when called with a path that exists" do
63
63
  security_descriptor = Chef::ReservedNames::Win32::Security.get_file_security(
64
- "C:\\Program Files")
64
+ "C:\\Program Files"
65
+ )
65
66
  # Make sure the security descriptor works
66
67
  expect(security_descriptor.dacl_present?).to be true
67
68
  end
@@ -70,7 +71,8 @@ describe "Chef::Win32::Security", :windows_only do
70
71
  describe "access_check" do
71
72
  let(:security_descriptor) do
72
73
  Chef::ReservedNames::Win32::Security.get_file_security(
73
- "C:\\Program Files")
74
+ "C:\\Program Files"
75
+ )
74
76
  end
75
77
 
76
78
  let(:token_rights) { Chef::ReservedNames::Win32::Security::TOKEN_ALL_ACCESS }
@@ -78,7 +80,8 @@ describe "Chef::Win32::Security", :windows_only do
78
80
  let(:token) do
79
81
  Chef::ReservedNames::Win32::Security.open_process_token(
80
82
  Chef::ReservedNames::Win32::Process.get_current_process,
81
- token_rights).duplicate_token(:SecurityImpersonation)
83
+ token_rights
84
+ ).duplicate_token(:SecurityImpersonation)
82
85
  end
83
86
 
84
87
  let(:mapping) do
@@ -94,7 +97,7 @@ describe "Chef::Win32::Security", :windows_only do
94
97
 
95
98
  it "should check if the provided token has the desired access" do
96
99
  expect(Chef::ReservedNames::Win32::Security.access_check(security_descriptor,
97
- token, desired_access, mapping)).to be true
100
+ token, desired_access, mapping)).to be true
98
101
  end
99
102
  end
100
103
 
@@ -102,7 +105,8 @@ describe "Chef::Win32::Security", :windows_only do
102
105
  let(:token) do
103
106
  Chef::ReservedNames::Win32::Security.open_process_token(
104
107
  Chef::ReservedNames::Win32::Process.get_current_process,
105
- token_rights)
108
+ token_rights
109
+ )
106
110
  end
107
111
  context "with all rights" do
108
112
  let(:token_rights) { Chef::ReservedNames::Win32::Security::TOKEN_ALL_ACCESS }
@@ -127,11 +131,12 @@ describe "Chef::Win32::Security", :windows_only do
127
131
  let(:token) do
128
132
  Chef::ReservedNames::Win32::Security.open_process_token(
129
133
  Chef::ReservedNames::Win32::Process.get_current_process,
130
- token_rights)
134
+ token_rights
135
+ )
131
136
  end
132
137
 
133
138
  context "when the token is valid" do
134
- let(:token_elevation_type) { [:TokenElevationTypeDefault, :TokenElevationTypeFull, :TokenElevationTypeLimited] }
139
+ let(:token_elevation_type) { %i{TokenElevationTypeDefault TokenElevationTypeFull TokenElevationTypeLimited} }
135
140
 
136
141
  it "returns the token elevation type" do
137
142
  elevation_type = Chef::ReservedNames::Win32::Security.get_token_information_elevation_type(token)
@@ -43,7 +43,7 @@ describe "Chef::Application::WindowsServiceManager", :windows_only, :system_wind
43
43
  end
44
44
 
45
45
  it "throws an error with required missing options" do
46
- [:service_name, :service_display_name, :service_description, :service_file_path].each do |key|
46
+ %i{service_name service_display_name service_description service_file_path}.each do |key|
47
47
  service_def = test_service.dup
48
48
  service_def.delete(key)
49
49
 
@@ -32,12 +32,12 @@ describe "Chef::ReservedNames::Win32::File::VersionInfo", :windows_only do
32
32
 
33
33
  subject { Chef::ReservedNames::Win32::File::VersionInfo.new(file_path) }
34
34
 
35
- it "file version has the same version as windows" do
36
- expect(subject.FileVersion).to start_with(os_version)
35
+ it "file version has the same major.minor version as windows" do
36
+ expect(subject.FileVersion).to start_with(os_version.rpartition(".").first)
37
37
  end
38
38
 
39
- it "product version has the same version as windows" do
40
- expect(subject.ProductVersion).to start_with(os_version)
39
+ it "product version has the same major.minor version as windows" do
40
+ expect(subject.ProductVersion).to start_with(os_version.rpartition(".").first)
41
41
  end
42
42
 
43
43
  it "company is microsoft" do
@@ -20,9 +20,7 @@ describe "chef-client" do
20
20
  # just a normal file
21
21
  # (expected_content should be uncompressed)
22
22
  @api.get("/recipes.tgz", 200) do
23
- File.open(recipes_filename, "rb") do |f|
24
- f.read
25
- end
23
+ File.open(recipes_filename, "rb", &:read)
26
24
  end
27
25
  end
28
26
 
@@ -56,35 +54,19 @@ describe "chef-client" do
56
54
  it "should complete with success" do
57
55
  file "config/client.rb", <<~EOM
58
56
  local_mode true
59
- cookbook_path "#{path_to('cookbooks')}"
60
- EOM
61
-
62
- shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir)
63
- end
64
-
65
- it "should complete successfully with no other environment variables", skip: (Chef::Platform.windows?) do
66
- file "config/client.rb", <<~EOM
67
- local_mode true
68
- cookbook_path "#{path_to('cookbooks')}"
69
- EOM
57
+ cookbook_path "#{path_to("cookbooks")}"
58
+ EOM
70
59
 
71
- begin
72
- result = shell_out("env -i #{critical_env_vars} #{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir)
73
- result.error!
74
- rescue
75
- Chef::Log.info "Bare invocation will have the following load-path."
76
- Chef::Log.info shell_out!("env -i #{critical_env_vars} ruby -e 'puts $:'").stdout
77
- raise
78
- end
60
+ shell_out!("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default'", cwd: chef_dir)
79
61
  end
80
62
 
81
63
  it "should complete successfully with --no-listen" do
82
64
  file "config/client.rb", <<~EOM
83
65
  local_mode true
84
- cookbook_path "#{path_to('cookbooks')}"
85
- EOM
66
+ cookbook_path "#{path_to("cookbooks")}"
67
+ EOM
86
68
 
87
- result = shell_out("#{chef_client} --no-listen -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir)
69
+ result = shell_out("#{chef_client} --no-listen -c \"#{path_to("config/client.rb")}\" -o 'x::default'", cwd: chef_dir)
88
70
  result.error!
89
71
  end
90
72
 
@@ -125,10 +107,10 @@ EOM
125
107
  it "should complete with success" do
126
108
  file "config/client.rb", <<~EOM
127
109
  local_mode true
128
- cookbook_path "#{path_to('cookbooks')}"
129
- EOM
110
+ cookbook_path "#{path_to("cookbooks")}"
111
+ EOM
130
112
 
131
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir)
113
+ result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default'", cwd: chef_dir)
132
114
  result.error!
133
115
  end
134
116
 
@@ -162,40 +144,40 @@ EOM
162
144
  syHLXYFNy0OxMtH/bBAXBGNHd9gf5uOnqh0pYcbe/uRAxumC7Rl0cL509eURiA2T
163
145
  +vFmf54y9YdnLXaqv+FhJT6B6V7WX7IpU9BMqJY1cJYXHuHG2KA=
164
146
  -----END RSA PRIVATE KEY-----
165
- EOM
147
+ EOM
166
148
  end
167
149
 
168
150
  it "should complete with success even with a client key" do
169
151
  file "config/client.rb", <<~EOM
170
152
  local_mode true
171
- client_key #{path_to('mykey.pem').inspect}
172
- cookbook_path #{path_to('cookbooks').inspect}
173
- EOM
153
+ client_key #{path_to("mykey.pem").inspect}
154
+ cookbook_path #{path_to("cookbooks").inspect}
155
+ EOM
174
156
 
175
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir)
157
+ result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default'", cwd: chef_dir)
176
158
  result.error!
177
159
  end
178
160
 
179
161
  it "should run recipes specified directly on the command line" do
180
162
  file "config/client.rb", <<~EOM
181
163
  local_mode true
182
- client_key #{path_to('mykey.pem').inspect}
183
- cookbook_path #{path_to('cookbooks').inspect}
184
- EOM
164
+ client_key #{path_to("mykey.pem").inspect}
165
+ cookbook_path #{path_to("cookbooks").inspect}
166
+ EOM
185
167
 
186
168
  file "arbitrary.rb", <<~EOM
187
- file #{path_to('tempfile.txt').inspect} do
169
+ file #{path_to("tempfile.txt").inspect} do
188
170
  content '1'
189
171
  end
190
- EOM
172
+ EOM
191
173
 
192
174
  file "arbitrary2.rb", <<~EOM
193
- file #{path_to('tempfile2.txt').inspect} do
175
+ file #{path_to("tempfile2.txt").inspect} do
194
176
  content '2'
195
177
  end
196
- EOM
178
+ EOM
197
179
 
198
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" #{path_to('arbitrary.rb')} #{path_to('arbitrary2.rb')}", cwd: chef_dir)
180
+ result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" #{path_to("arbitrary.rb")} #{path_to("arbitrary2.rb")}", cwd: chef_dir)
199
181
  result.error!
200
182
 
201
183
  expect(IO.read(path_to("tempfile.txt"))).to eq("1")
@@ -205,17 +187,17 @@ EOM
205
187
  it "should run recipes specified as relative paths directly on the command line" do
206
188
  file "config/client.rb", <<~EOM
207
189
  local_mode true
208
- client_key #{path_to('mykey.pem').inspect}
209
- cookbook_path #{path_to('cookbooks').inspect}
210
- EOM
190
+ client_key #{path_to("mykey.pem").inspect}
191
+ cookbook_path #{path_to("cookbooks").inspect}
192
+ EOM
211
193
 
212
194
  file "arbitrary.rb", <<~EOM
213
- file #{path_to('tempfile.txt').inspect} do
195
+ file #{path_to("tempfile.txt").inspect} do
214
196
  content '1'
215
197
  end
216
- EOM
198
+ EOM
217
199
 
218
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" arbitrary.rb", cwd: path_to(""))
200
+ result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" arbitrary.rb", cwd: path_to(""))
219
201
  result.error!
220
202
 
221
203
  expect(IO.read(path_to("tempfile.txt"))).to eq("1")
@@ -224,22 +206,22 @@ EOM
224
206
  it "should run recipes specified directly on the command line AFTER recipes in the run list" do
225
207
  file "config/client.rb", <<~EOM
226
208
  local_mode true
227
- client_key #{path_to('mykey.pem').inspect}
228
- cookbook_path #{path_to('cookbooks').inspect}
229
- EOM
209
+ client_key #{path_to("mykey.pem").inspect}
210
+ cookbook_path #{path_to("cookbooks").inspect}
211
+ EOM
230
212
 
231
213
  file "cookbooks/x/recipes/constant_definition.rb", <<~EOM
232
214
  class ::Blah
233
215
  THECONSTANT = '1'
234
216
  end
235
- EOM
217
+ EOM
236
218
  file "arbitrary.rb", <<~EOM
237
- file #{path_to('tempfile.txt').inspect} do
219
+ file #{path_to("tempfile.txt").inspect} do
238
220
  content ::Blah::THECONSTANT
239
221
  end
240
- EOM
222
+ EOM
241
223
 
242
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o x::constant_definition arbitrary.rb", cwd: path_to(""))
224
+ result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o x::constant_definition arbitrary.rb", cwd: path_to(""))
243
225
  result.error!
244
226
 
245
227
  expect(IO.read(path_to("tempfile.txt"))).to eq("1")
@@ -250,30 +232,30 @@ EOM
250
232
  it "should complete with success when passed the -z flag" do
251
233
  file "config/client.rb", <<~EOM
252
234
  chef_server_url 'http://omg.com/blah'
253
- cookbook_path "#{path_to('cookbooks')}"
254
- EOM
235
+ cookbook_path "#{path_to("cookbooks")}"
236
+ EOM
255
237
 
256
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z", cwd: chef_dir)
238
+ result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' -z", cwd: chef_dir)
257
239
  result.error!
258
240
  end
259
241
 
260
242
  it "should complete with success when passed the --local-mode flag" do
261
243
  file "config/client.rb", <<~EOM
262
244
  chef_server_url 'http://omg.com/blah'
263
- cookbook_path "#{path_to('cookbooks')}"
264
- EOM
245
+ cookbook_path "#{path_to("cookbooks")}"
246
+ EOM
265
247
 
266
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --local-mode", cwd: chef_dir)
248
+ result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --local-mode", cwd: chef_dir)
267
249
  result.error!
268
250
  end
269
251
 
270
252
  it "should not print SSL warnings when running in local-mode" do
271
253
  file "config/client.rb", <<~EOM
272
254
  chef_server_url 'http://omg.com/blah'
273
- cookbook_path "#{path_to('cookbooks')}"
274
- EOM
255
+ cookbook_path "#{path_to("cookbooks")}"
256
+ EOM
275
257
 
276
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --local-mode", cwd: chef_dir)
258
+ result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --local-mode", cwd: chef_dir)
277
259
  expect(result.stdout).not_to include("SSL validation of HTTPS requests is disabled.")
278
260
  result.error!
279
261
  end
@@ -281,20 +263,20 @@ EOM
281
263
  it "should complete with success when passed -z and --chef-zero-port" do
282
264
  file "config/client.rb", <<~EOM
283
265
  chef_server_url 'http://omg.com/blah'
284
- cookbook_path "#{path_to('cookbooks')}"
285
- EOM
266
+ cookbook_path "#{path_to("cookbooks")}"
267
+ EOM
286
268
 
287
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z", cwd: chef_dir)
269
+ result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' -z", cwd: chef_dir)
288
270
  result.error!
289
271
  end
290
272
 
291
273
  it "should complete with success when setting the run list with -r" do
292
274
  file "config/client.rb", <<~EOM
293
275
  chef_server_url 'http://omg.com/blah'
294
- cookbook_path "#{path_to('cookbooks')}"
295
- EOM
276
+ cookbook_path "#{path_to("cookbooks")}"
277
+ EOM
296
278
 
297
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -r 'x::default' -z -l info", cwd: chef_dir)
279
+ result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -r 'x::default' -z -l info", cwd: chef_dir)
298
280
  expect(result.stdout).not_to include("Overridden Run List")
299
281
  expect(result.stdout).to include("Run List is [recipe[x::default]]")
300
282
  result.error!
@@ -303,9 +285,9 @@ EOM
303
285
  it "should complete with success when using --profile-ruby and output a profile file", :not_supported_on_aix do
304
286
  file "config/client.rb", <<~EOM
305
287
  local_mode true
306
- cookbook_path "#{path_to('cookbooks')}"
307
- EOM
308
- result = shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z --profile-ruby", cwd: chef_dir)
288
+ cookbook_path "#{path_to("cookbooks")}"
289
+ EOM
290
+ result = shell_out!("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' -z --profile-ruby", cwd: chef_dir)
309
291
  result.error!
310
292
  expect(File.exist?(path_to("config/local-mode-cache/cache/graph_profile.out"))).to be true
311
293
  end
@@ -313,9 +295,9 @@ EOM
313
295
  it "doesn't produce a profile when --profile-ruby is not present" do
314
296
  file "config/client.rb", <<~EOM
315
297
  local_mode true
316
- cookbook_path "#{path_to('cookbooks')}"
317
- EOM
318
- result = shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z", cwd: chef_dir)
298
+ cookbook_path "#{path_to("cookbooks")}"
299
+ EOM
300
+ result = shell_out!("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' -z", cwd: chef_dir)
319
301
  result.error!
320
302
  expect(File.exist?(path_to("config/local-mode-cache/cache/graph_profile.out"))).to be false
321
303
  end
@@ -328,14 +310,14 @@ EOM
328
310
  name 'x'
329
311
  version '0.0.1'
330
312
  chef_version '~> 999.99'
331
- EOM
313
+ EOM
332
314
  file "config/client.rb", <<~EOM
333
315
  local_mode true
334
- cookbook_path "#{path_to('cookbooks')}"
335
- EOM
316
+ cookbook_path "#{path_to("cookbooks")}"
317
+ EOM
336
318
  end
337
319
  it "should fail the chef client run" do
338
- command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir)
320
+ command = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --no-fork", cwd: chef_dir)
339
321
  expect(command.exitstatus).to eql(1)
340
322
  expect(command.stdout).to match(/Chef::Exceptions::CookbookChefVersionMismatch/)
341
323
  end
@@ -356,12 +338,12 @@ EOM
356
338
  EOM
357
339
  file "config/client.rb", <<-EOM
358
340
  local_mode true
359
- cookbook_path "#{path_to('cookbooks')}"
341
+ cookbook_path "#{path_to("cookbooks")}"
360
342
  EOM
361
343
  end
362
344
 
363
345
  it "the cheffish DSL is loaded lazily" do
364
- command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir)
346
+ command = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --no-fork", cwd: chef_dir)
365
347
  expect(command.exitstatus).to eql(0)
366
348
  end
367
349
  end
@@ -373,16 +355,16 @@ EOM
373
355
  EOM
374
356
  file "config/client.rb", <<-EOM
375
357
  local_mode true
376
- cookbook_path "#{path_to('cookbooks')}"
358
+ cookbook_path "#{path_to("cookbooks")}"
377
359
  EOM
378
360
  end
379
361
 
380
362
  it "the cheffish DSL tries to load but fails (because chef-provisioning is not there)" do
381
363
  # we'd need to have a custom bundle to fix this that omitted chef-provisioning, but that would dig our crazy even deeper, so lets not
382
364
  skip "but if chef-provisioning is in our bundle or in our gemset then this test, very annoyingly, always fails"
383
- command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir)
365
+ command = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --no-fork", cwd: chef_dir)
384
366
  expect(command.exitstatus).to eql(1)
385
- expect(command.stdout).to match(/cannot load such file -- chef\/provisioning/)
367
+ expect(command.stdout).to match(%r{cannot load such file -- chef/provisioning})
386
368
  end
387
369
  end
388
370
 
@@ -407,15 +389,15 @@ EOM
407
389
  it "should output each deprecation warning only once, at the end of the run" do
408
390
  file "config/client.rb", <<~EOM
409
391
  local_mode true
410
- cookbook_path "#{path_to('cookbooks')}"
392
+ cookbook_path "#{path_to("cookbooks")}"
411
393
  # Mimick what happens when you are on the console
412
394
  formatters << :doc
413
395
  log_level :warn
414
- EOM
396
+ EOM
415
397
 
416
398
  ENV.delete("CHEF_TREAT_DEPRECATION_WARNINGS_AS_ERRORS")
417
399
 
418
- result = shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir)
400
+ result = shell_out!("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default'", cwd: chef_dir)
419
401
  expect(result.error?).to be_falsey
420
402
 
421
403
  # Search to the end of the client run in the output
@@ -432,10 +414,10 @@ EOM
432
414
  before do
433
415
  file "config/client.rb", <<~EOM
434
416
  local_mode true
435
- cookbook_path "#{path_to('cookbooks')}"
417
+ cookbook_path "#{path_to("cookbooks")}"
436
418
  audit_mode :enabled
437
419
  silence_deprecation_warnings %w{chef-27}
438
- EOM
420
+ EOM
439
421
  end
440
422
 
441
423
  it "should exit with a zero code when there is not an audit failure" do
@@ -447,7 +429,7 @@ EOM
447
429
  end
448
430
  RECIPE
449
431
 
450
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'audit_test::succeed' -l info", cwd: chef_dir)
432
+ result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'audit_test::succeed' -l info", cwd: chef_dir)
451
433
  expect(result.error?).to be_falsey
452
434
  expect(result.stdout).to include("Successfully executed all `control_group` blocks and contained examples")
453
435
  end
@@ -461,7 +443,7 @@ EOM
461
443
  end
462
444
  RECIPE
463
445
 
464
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'audit_test::fail'", cwd: chef_dir)
446
+ result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'audit_test::fail'", cwd: chef_dir)
465
447
  expect(result.error?).to be_truthy
466
448
  expect(result.stdout).to include("Failure/Error: expect(2 - 2).to eq(1)")
467
449
  end
@@ -470,7 +452,7 @@ EOM
470
452
  when_the_repository "has a cookbook that deploys a file" do
471
453
  before do
472
454
  file "cookbooks/x/recipes/default.rb", <<~RECIPE
473
- cookbook_file #{path_to('tempfile.txt').inspect} do
455
+ cookbook_file #{path_to("tempfile.txt").inspect} do
474
456
  source "my_file"
475
457
  end
476
458
  RECIPE
@@ -486,9 +468,9 @@ EOM
486
468
  file "config/client.rb", <<~EOM
487
469
  no_lazy_load #{lazy}
488
470
  local_mode true
489
- cookbook_path "#{path_to('cookbooks')}"
490
- EOM
491
- result = shell_out("#{chef_client} -l debug -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir)
471
+ cookbook_path "#{path_to("cookbooks")}"
472
+ EOM
473
+ result = shell_out("#{chef_client} -l debug -c \"#{path_to("config/client.rb")}\" -o 'x::default' --no-fork", cwd: chef_dir)
492
474
  result.error!
493
475
 
494
476
  expect(IO.read(path_to("tempfile.txt")).strip).to eq("this is my file")
@@ -500,7 +482,7 @@ EOM
500
482
  when_the_repository "has a cookbook with an ohai plugin" do
501
483
  before do
502
484
  file "cookbooks/x/recipes/default.rb", <<~RECIPE
503
- file #{path_to('tempfile.txt').inspect} do
485
+ file #{path_to("tempfile.txt").inspect} do
504
486
  content node["english"]["version"]
505
487
  end
506
488
  RECIPE
@@ -518,12 +500,12 @@ EOM
518
500
 
519
501
  file "config/client.rb", <<~EOM
520
502
  local_mode true
521
- cookbook_path "#{path_to('cookbooks')}"
522
- EOM
503
+ cookbook_path "#{path_to("cookbooks")}"
504
+ EOM
523
505
  end
524
506
 
525
507
  it "should run the ohai plugin" do
526
- result = shell_out("#{chef_client} -l debug -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir)
508
+ result = shell_out("#{chef_client} -l debug -c \"#{path_to("config/client.rb")}\" -o 'x::default' --no-fork", cwd: chef_dir)
527
509
  result.error!
528
510
 
529
511
  expect(IO.read(path_to("tempfile.txt"))).to eq("2014")
@@ -545,8 +527,8 @@ EOM
545
527
  it "should complete with success when passed -z and --recipe-url" do
546
528
  file "config/client.rb", <<~EOM
547
529
  chef_repo_path "#{tmp_dir}"
548
- EOM
549
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --recipe-url=http://localhost:9000/recipes.tgz -o 'x::default' -z", cwd: tmp_dir)
530
+ EOM
531
+ result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" --recipe-url=http://localhost:9000/recipes.tgz -o 'x::default' -z", cwd: tmp_dir)
550
532
  result.error!
551
533
  end
552
534
 
@@ -569,27 +551,27 @@ EOM
569
551
  name 'x'
570
552
  version '0.0.1'
571
553
  raise "TEH SADNESS"
572
- EOM
554
+ EOM
573
555
  file "cookbooks/x/metadata.json", <<~EOM
574
556
  {
575
557
  "name": "x",
576
558
  "version": "0.0.1"
577
559
  }
578
- EOM
560
+ EOM
579
561
 
580
562
  file "config/client.rb", <<~EOM
581
563
  local_mode true
582
- cookbook_path "#{path_to('cookbooks')}"
583
- EOM
564
+ cookbook_path "#{path_to("cookbooks")}"
565
+ EOM
584
566
  end
585
567
 
586
568
  it "the chef client run should succeed" do
587
- command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir)
569
+ command = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --no-fork", cwd: chef_dir)
588
570
  command.error!
589
571
  end
590
572
 
591
573
  it "a chef-solo run should succeed" do
592
- command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir)
574
+ command = shell_out("#{chef_solo} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --no-fork", cwd: chef_dir)
593
575
  command.error!
594
576
  end
595
577
  end
@@ -603,30 +585,30 @@ EOM
603
585
  EOM
604
586
  file "config/client.rb", <<~EOM
605
587
  local_mode true
606
- cookbook_path "#{path_to('cookbooks')}"
607
- EOM
588
+ cookbook_path "#{path_to("cookbooks")}"
589
+ EOM
608
590
  end
609
591
 
610
592
  it "a chef client run should not log to info by default" do
611
- command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir)
593
+ command = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --no-fork", cwd: chef_dir)
612
594
  command.error!
613
595
  expect(command.stdout).not_to include("INFO")
614
596
  end
615
597
 
616
598
  it "a chef client run to a pipe should not log to info by default" do
617
- command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork | tee #{path_to('chefrun.out')}", cwd: chef_dir)
599
+ command = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --no-fork | tee #{path_to("chefrun.out")}", cwd: chef_dir)
618
600
  command.error!
619
601
  expect(command.stdout).not_to include("INFO")
620
602
  end
621
603
 
622
604
  it "a chef solo run should not log to info by default" do
623
- command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir)
605
+ command = shell_out("#{chef_solo} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --no-fork", cwd: chef_dir)
624
606
  command.error!
625
607
  expect(command.stdout).not_to include("INFO")
626
608
  end
627
609
 
628
610
  it "a chef solo run to a pipe should not log to info by default" do
629
- command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork | tee #{path_to('chefrun.out')}", cwd: chef_dir)
611
+ command = shell_out("#{chef_solo} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --no-fork | tee #{path_to("chefrun.out")}", cwd: chef_dir)
630
612
  command.error!
631
613
  expect(command.stdout).not_to include("INFO")
632
614
  end
@@ -636,45 +618,45 @@ EOM
636
618
  before do
637
619
  file "cookbooks/x/recipes/default.rb", <<~EOM
638
620
  puts Chef::Config[:client_fork] ? "WITHFORK" : "NOFORK"
639
- EOM
621
+ EOM
640
622
  file "config/client.rb", <<~EOM
641
623
  local_mode true
642
- cookbook_path "#{path_to('cookbooks')}"
643
- EOM
624
+ cookbook_path "#{path_to("cookbooks")}"
625
+ EOM
644
626
  end
645
627
 
646
628
  it "chef-client runs by default with no supervisor" do
647
- command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir)
629
+ command = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default'", cwd: chef_dir)
648
630
  command.error!
649
631
  expect(command.stdout).to include("NOFORK")
650
632
  end
651
633
 
652
634
  it "chef-solo runs by default with no supervisor" do
653
- command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir)
635
+ command = shell_out("#{chef_solo} -c \"#{path_to("config/client.rb")}\" -o 'x::default'", cwd: chef_dir)
654
636
  command.error!
655
637
  expect(command.stdout).to include("NOFORK")
656
638
  end
657
639
 
658
640
  it "chef-client --no-fork does not fork" do
659
- command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir)
641
+ command = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --no-fork", cwd: chef_dir)
660
642
  command.error!
661
643
  expect(command.stdout).to include("NOFORK")
662
644
  end
663
645
 
664
646
  it "chef-solo --no-fork does not fork" do
665
- command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir)
647
+ command = shell_out("#{chef_solo} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --no-fork", cwd: chef_dir)
666
648
  command.error!
667
649
  expect(command.stdout).to include("NOFORK")
668
650
  end
669
651
 
670
652
  it "chef-client with --fork uses a supervisor" do
671
- command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --fork", cwd: chef_dir)
653
+ command = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --fork", cwd: chef_dir)
672
654
  command.error!
673
655
  expect(command.stdout).to include("WITHFORK")
674
656
  end
675
657
 
676
658
  it "chef-solo with --fork uses a supervisor" do
677
- command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --fork", cwd: chef_dir)
659
+ command = shell_out("#{chef_solo} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --fork", cwd: chef_dir)
678
660
  command.error!
679
661
  expect(command.stdout).to include("WITHFORK")
680
662
  end
@@ -684,22 +666,22 @@ EOM
684
666
  before do
685
667
  file "cookbooks/x/recipes/default.rb", <<~EOM
686
668
  puts Chef::Config[:client_fork] ? "WITHFORK" : "NOFORK"
687
- EOM
669
+ EOM
688
670
  file "config/client.rb", <<~EOM
689
671
  local_mode true
690
- cookbook_path "#{path_to('cookbooks')}"
672
+ cookbook_path "#{path_to("cookbooks")}"
691
673
  client_fork true
692
- EOM
674
+ EOM
693
675
  end
694
676
 
695
677
  it "chef-client uses a supervisor" do
696
- command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir)
678
+ command = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default'", cwd: chef_dir)
697
679
  command.error!
698
680
  expect(command.stdout).to include("WITHFORK")
699
681
  end
700
682
 
701
683
  it "chef-solo uses a supervisor" do
702
- command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir)
684
+ command = shell_out("#{chef_solo} -c \"#{path_to("config/client.rb")}\" -o 'x::default'", cwd: chef_dir)
703
685
  command.error!
704
686
  expect(command.stdout).to include("WITHFORK")
705
687
  end
@@ -709,22 +691,22 @@ EOM
709
691
  before do
710
692
  file "cookbooks/x/recipes/default.rb", <<~EOM
711
693
  puts Chef::Config[:client_fork] ? "WITHFORK" : "NOFORK"
712
- EOM
694
+ EOM
713
695
  file "config/client.rb", <<~EOM
714
696
  local_mode true
715
- cookbook_path "#{path_to('cookbooks')}"
697
+ cookbook_path "#{path_to("cookbooks")}"
716
698
  client_fork false
717
- EOM
699
+ EOM
718
700
  end
719
701
 
720
702
  it "chef-client uses a supervisor" do
721
- command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir)
703
+ command = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default'", cwd: chef_dir)
722
704
  command.error!
723
705
  expect(command.stdout).to include("NOFORK")
724
706
  end
725
707
 
726
708
  it "chef-solo uses a supervisor" do
727
- command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir)
709
+ command = shell_out("#{chef_solo} -c \"#{path_to("config/client.rb")}\" -o 'x::default'", cwd: chef_dir)
728
710
  command.error!
729
711
  expect(command.stdout).to include("NOFORK")
730
712
  end