chef 15.1.36-universal-mingw32 → 15.2.20-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (808) hide show
  1. checksums.yaml +4 -4
  2. data/bin/knife +0 -0
  3. data/ext/win32-eventlog/Rakefile +1 -1
  4. data/lib/chef.rb +1 -2
  5. data/lib/chef/action_collection.rb +8 -0
  6. data/lib/chef/api_client.rb +2 -2
  7. data/lib/chef/api_client/registration.rb +8 -7
  8. data/lib/chef/api_client_v1.rb +2 -1
  9. data/lib/chef/application.rb +1 -0
  10. data/lib/chef/application/apply.rb +1 -1
  11. data/lib/chef/application/base.rb +440 -0
  12. data/lib/chef/application/client.rb +6 -389
  13. data/lib/chef/application/solo.rb +11 -258
  14. data/lib/chef/application/windows_service.rb +3 -3
  15. data/lib/chef/application/windows_service_manager.rb +3 -3
  16. data/lib/chef/blacklist.rb +1 -1
  17. data/lib/chef/chef_fs/chef_fs_data_store.rb +15 -7
  18. data/lib/chef/chef_fs/command_line.rb +6 -1
  19. data/lib/chef/chef_fs/config.rb +3 -2
  20. data/lib/chef/chef_fs/data_handler/container_data_handler.rb +1 -1
  21. data/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb +1 -1
  22. data/lib/chef/chef_fs/data_handler/data_handler_base.rb +1 -1
  23. data/lib/chef/chef_fs/data_handler/organization_data_handler.rb +1 -1
  24. data/lib/chef/chef_fs/data_handler/policy_data_handler.rb +2 -2
  25. data/lib/chef/chef_fs/file_pattern.rb +13 -7
  26. data/lib/chef/chef_fs/file_system.rb +3 -2
  27. data/lib/chef/chef_fs/file_system/base_fs_object.rb +13 -6
  28. data/lib/chef/chef_fs/file_system/chef_server/chef_server_root_dir.rb +1 -1
  29. data/lib/chef/chef_fs/file_system/chef_server/cookbook_artifacts_dir.rb +1 -1
  30. data/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb +8 -5
  31. data/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb +1 -1
  32. data/lib/chef/chef_fs/file_system/chef_server/cookbook_subdir.rb +1 -1
  33. data/lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb +1 -1
  34. data/lib/chef/chef_fs/file_system/chef_server/data_bag_dir.rb +3 -2
  35. data/lib/chef/chef_fs/file_system/chef_server/environments_dir.rb +4 -2
  36. data/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb +1 -0
  37. data/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb +1 -0
  38. data/lib/chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir.rb +1 -1
  39. data/lib/chef/chef_fs/file_system/memory/memory_dir.rb +1 -1
  40. data/lib/chef/chef_fs/file_system/repository/acl.rb +1 -1
  41. data/lib/chef/chef_fs/file_system/repository/base_file.rb +2 -1
  42. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +6 -2
  43. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +6 -4
  44. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +6 -4
  45. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbook_dir.rb +1 -0
  46. data/lib/chef/chef_fs/file_system/repository/directory.rb +5 -1
  47. data/lib/chef/chef_fs/file_system/repository/file_system_entry.rb +4 -2
  48. data/lib/chef/chef_fs/file_system_cache.rb +1 -0
  49. data/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb +2 -1
  50. data/lib/chef/chef_fs/path_utils.rb +3 -0
  51. data/lib/chef/client.rb +4 -2
  52. data/lib/chef/config.rb +1 -1
  53. data/lib/chef/cookbook/cookbook_version_loader.rb +6 -3
  54. data/lib/chef/cookbook/file_system_file_vendor.rb +1 -0
  55. data/lib/chef/cookbook/file_vendor.rb +1 -0
  56. data/lib/chef/cookbook/gem_installer.rb +1 -0
  57. data/lib/chef/cookbook/manifest_v0.rb +1 -0
  58. data/lib/chef/cookbook/metadata.rb +11 -9
  59. data/lib/chef/cookbook/remote_file_vendor.rb +3 -2
  60. data/lib/chef/cookbook/synchronizer.rb +6 -4
  61. data/lib/chef/cookbook/syntax_check.rb +4 -0
  62. data/lib/chef/cookbook_loader.rb +1 -0
  63. data/lib/chef/cookbook_manifest.rb +4 -2
  64. data/lib/chef/cookbook_site_streaming_uploader.rb +1 -1
  65. data/lib/chef/cookbook_uploader.rb +2 -2
  66. data/lib/chef/cookbook_version.rb +10 -9
  67. data/lib/chef/data_bag.rb +2 -1
  68. data/lib/chef/data_bag_item.rb +6 -3
  69. data/lib/chef/data_collector.rb +16 -8
  70. data/lib/chef/data_collector/run_end_message.rb +2 -0
  71. data/lib/chef/decorator.rb +5 -6
  72. data/lib/chef/deprecated.rb +1 -0
  73. data/lib/chef/dsl/data_query.rb +1 -1
  74. data/lib/chef/dsl/declare_resource.rb +2 -0
  75. data/lib/chef/dsl/platform_introspection.rb +3 -1
  76. data/lib/chef/encrypted_data_bag_item.rb +7 -4
  77. data/lib/chef/encrypted_data_bag_item/assertions.rb +1 -1
  78. data/lib/chef/encrypted_data_bag_item/check_encrypted.rb +1 -0
  79. data/lib/chef/encrypted_data_bag_item/decryptor.rb +4 -2
  80. data/lib/chef/encrypted_data_bag_item/encryptor.rb +1 -0
  81. data/lib/chef/environment.rb +7 -5
  82. data/lib/chef/event_dispatch/base.rb +86 -172
  83. data/lib/chef/event_dispatch/dispatcher.rb +2 -1
  84. data/lib/chef/event_loggers/base.rb +2 -1
  85. data/lib/chef/exceptions.rb +6 -7
  86. data/lib/chef/file_access_control/unix.rb +7 -4
  87. data/lib/chef/file_access_control/windows.rb +17 -8
  88. data/lib/chef/file_cache.rb +2 -1
  89. data/lib/chef/file_content_management/deploy.rb +2 -2
  90. data/lib/chef/formatters/base.rb +3 -4
  91. data/lib/chef/formatters/doc.rb +21 -33
  92. data/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb +3 -2
  93. data/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb +3 -1
  94. data/lib/chef/formatters/indentable_output_stream.rb +3 -3
  95. data/lib/chef/formatters/minimal.rb +21 -42
  96. data/lib/chef/guard_interpreter/resource_guard_interpreter.rb +1 -1
  97. data/lib/chef/handler.rb +1 -2
  98. data/lib/chef/http.rb +23 -18
  99. data/lib/chef/http/api_versions.rb +1 -2
  100. data/lib/chef/http/auth_credentials.rb +1 -0
  101. data/lib/chef/http/basic_client.rb +1 -1
  102. data/lib/chef/http/decompressor.rb +1 -0
  103. data/lib/chef/http/json_output.rb +2 -1
  104. data/lib/chef/http/json_to_model_output.rb +1 -1
  105. data/lib/chef/http/remote_request_id.rb +1 -2
  106. data/lib/chef/http/socketless_chef_zero_client.rb +3 -2
  107. data/lib/chef/http/ssl_policies.rb +3 -0
  108. data/lib/chef/http/validate_content_length.rb +2 -2
  109. data/lib/chef/json_compat.rb +1 -1
  110. data/lib/chef/key.rb +8 -6
  111. data/lib/chef/knife.rb +6 -5
  112. data/lib/chef/knife/bootstrap.rb +19 -12
  113. data/lib/chef/knife/bootstrap/chef_vault_handler.rb +1 -0
  114. data/lib/chef/knife/bootstrap/client_builder.rb +1 -0
  115. data/lib/chef/knife/bootstrap/train_connector.rb +23 -17
  116. data/lib/chef/knife/client_bulk_delete.rb +4 -3
  117. data/lib/chef/knife/client_create.rb +13 -13
  118. data/lib/chef/knife/client_delete.rb +3 -3
  119. data/lib/chef/knife/config_get.rb +8 -8
  120. data/lib/chef/knife/config_list_profiles.rb +4 -4
  121. data/lib/chef/knife/cookbook_delete.rb +1 -1
  122. data/lib/chef/knife/cookbook_download.rb +12 -12
  123. data/lib/chef/knife/cookbook_show.rb +10 -10
  124. data/lib/chef/knife/cookbook_upload.rb +5 -5
  125. data/lib/chef/knife/core/bootstrap_context.rb +1 -1
  126. data/lib/chef/knife/core/cookbook_scm_repo.rb +1 -1
  127. data/lib/chef/knife/core/gem_glob_loader.rb +2 -2
  128. data/lib/chef/knife/core/generic_presenter.rb +4 -4
  129. data/lib/chef/knife/core/node_presenter.rb +17 -17
  130. data/lib/chef/knife/core/object_loader.rb +1 -1
  131. data/lib/chef/knife/core/status_presenter.rb +5 -5
  132. data/lib/chef/knife/core/subcommand_loader.rb +3 -2
  133. data/lib/chef/knife/core/text_formatter.rb +4 -4
  134. data/lib/chef/knife/core/ui.rb +9 -5
  135. data/lib/chef/knife/data_bag_create.rb +1 -0
  136. data/lib/chef/knife/data_bag_from_file.rb +1 -1
  137. data/lib/chef/knife/data_bag_secret_options.rb +13 -13
  138. data/lib/chef/knife/data_bag_show.rb +2 -2
  139. data/lib/chef/knife/deps.rb +6 -6
  140. data/lib/chef/knife/edit.rb +2 -2
  141. data/lib/chef/knife/environment_compare.rb +1 -0
  142. data/lib/chef/knife/environment_from_file.rb +3 -3
  143. data/lib/chef/knife/key_create_base.rb +12 -12
  144. data/lib/chef/knife/key_edit_base.rb +15 -15
  145. data/lib/chef/knife/key_list.rb +3 -1
  146. data/lib/chef/knife/key_list_base.rb +9 -9
  147. data/lib/chef/knife/list.rb +5 -5
  148. data/lib/chef/knife/node_bulk_delete.rb +1 -0
  149. data/lib/chef/knife/node_edit.rb +1 -1
  150. data/lib/chef/knife/node_environment_set.rb +1 -2
  151. data/lib/chef/knife/node_run_list_add.rb +2 -2
  152. data/lib/chef/knife/node_run_list_remove.rb +2 -2
  153. data/lib/chef/knife/node_run_list_set.rb +2 -2
  154. data/lib/chef/knife/null.rb +1 -2
  155. data/lib/chef/knife/role_bulk_delete.rb +1 -0
  156. data/lib/chef/knife/role_env_run_list_add.rb +2 -2
  157. data/lib/chef/knife/role_env_run_list_set.rb +2 -2
  158. data/lib/chef/knife/role_run_list_add.rb +2 -2
  159. data/lib/chef/knife/role_run_list_set.rb +2 -2
  160. data/lib/chef/knife/search.rb +4 -4
  161. data/lib/chef/knife/ssh.rb +13 -9
  162. data/lib/chef/knife/supermarket_download.rb +1 -1
  163. data/lib/chef/knife/supermarket_install.rb +5 -5
  164. data/lib/chef/knife/supermarket_list.rb +1 -1
  165. data/lib/chef/knife/supermarket_share.rb +3 -2
  166. data/lib/chef/knife/supermarket_show.rb +1 -1
  167. data/lib/chef/knife/supermarket_unshare.rb +1 -0
  168. data/lib/chef/knife/tag_delete.rb +1 -1
  169. data/lib/chef/knife/xargs.rb +2 -2
  170. data/lib/chef/log/syslog.rb +2 -2
  171. data/lib/chef/log/winevt.rb +1 -2
  172. data/lib/chef/mash.rb +2 -2
  173. data/lib/chef/mixin/api_version_request_handling.rb +1 -1
  174. data/lib/chef/mixin/checksum.rb +1 -0
  175. data/lib/chef/mixin/convert_to_class_name.rb +2 -1
  176. data/lib/chef/mixin/create_path.rb +2 -2
  177. data/lib/chef/mixin/deep_merge.rb +5 -5
  178. data/lib/chef/mixin/get_source_from_package.rb +1 -0
  179. data/lib/chef/mixin/homebrew_user.rb +2 -1
  180. data/lib/chef/mixin/openssl_helper.rb +10 -6
  181. data/lib/chef/mixin/params_validate.rb +21 -13
  182. data/lib/chef/mixin/powershell_out.rb +1 -1
  183. data/lib/chef/mixin/powershell_type_coercions.rb +2 -2
  184. data/lib/chef/mixin/properties.rb +13 -10
  185. data/lib/chef/mixin/securable.rb +3 -3
  186. data/lib/chef/mixin/shell_out.rb +1 -0
  187. data/lib/chef/mixin/template.rb +2 -1
  188. data/lib/chef/mixin/user_context.rb +1 -1
  189. data/lib/chef/mixin/which.rb +1 -0
  190. data/lib/chef/mixin/windows_architecture_helper.rb +4 -4
  191. data/lib/chef/mixin/windows_env_helper.rb +2 -2
  192. data/lib/chef/monkey_patches/net_http.rb +1 -1
  193. data/lib/chef/monkey_patches/webrick-utils.rb +6 -4
  194. data/lib/chef/node.rb +24 -17
  195. data/lib/chef/node/attribute.rb +122 -113
  196. data/lib/chef/node/attribute_collections.rb +1 -1
  197. data/lib/chef/node/common_api.rb +8 -2
  198. data/lib/chef/node/immutable_collections.rb +1 -1
  199. data/lib/chef/node/mixin/immutablize_array.rb +142 -142
  200. data/lib/chef/node/mixin/immutablize_hash.rb +131 -131
  201. data/lib/chef/node_map.rb +18 -3
  202. data/lib/chef/null_logger.rb +8 -16
  203. data/lib/chef/org.rb +4 -4
  204. data/lib/chef/platform/query_helpers.rb +3 -0
  205. data/lib/chef/platform/rebooter.rb +1 -1
  206. data/lib/chef/platform/service_helpers.rb +2 -2
  207. data/lib/chef/policy_builder/expand_node_object.rb +4 -4
  208. data/lib/chef/policy_builder/policyfile.rb +4 -4
  209. data/lib/chef/powershell.rb +2 -0
  210. data/lib/chef/property.rb +7 -4
  211. data/lib/chef/provider.rb +9 -12
  212. data/lib/chef/provider/apt_preference.rb +1 -2
  213. data/lib/chef/provider/apt_repository.rb +1 -2
  214. data/lib/chef/provider/apt_update.rb +2 -3
  215. data/lib/chef/provider/cookbook_file.rb +1 -0
  216. data/lib/chef/provider/cron.rb +6 -5
  217. data/lib/chef/provider/cron/unix.rb +1 -0
  218. data/lib/chef/provider/dsc_resource.rb +2 -3
  219. data/lib/chef/provider/dsc_script.rb +2 -2
  220. data/lib/chef/provider/execute.rb +1 -1
  221. data/lib/chef/provider/file.rb +5 -3
  222. data/lib/chef/provider/git.rb +4 -3
  223. data/lib/chef/provider/group.rb +7 -3
  224. data/lib/chef/provider/group/aix.rb +2 -0
  225. data/lib/chef/provider/group/dscl.rb +6 -3
  226. data/lib/chef/provider/group/groupadd.rb +1 -0
  227. data/lib/chef/provider/group/groupmod.rb +1 -1
  228. data/lib/chef/provider/group/pw.rb +3 -3
  229. data/lib/chef/provider/group/suse.rb +2 -2
  230. data/lib/chef/provider/group/usermod.rb +1 -0
  231. data/lib/chef/provider/group/windows.rb +1 -1
  232. data/lib/chef/provider/http_request.rb +1 -1
  233. data/lib/chef/provider/ifconfig.rb +12 -6
  234. data/lib/chef/provider/ifconfig/aix.rb +1 -0
  235. data/lib/chef/provider/ifconfig/debian.rb +1 -0
  236. data/lib/chef/provider/launchd.rb +16 -13
  237. data/lib/chef/provider/lwrp_base.rb +1 -2
  238. data/lib/chef/provider/mount.rb +1 -0
  239. data/lib/chef/provider/mount/aix.rb +6 -6
  240. data/lib/chef/provider/mount/mount.rb +5 -4
  241. data/lib/chef/provider/mount/solaris.rb +4 -4
  242. data/lib/chef/provider/package.rb +9 -6
  243. data/lib/chef/provider/package/apt.rb +4 -3
  244. data/lib/chef/provider/package/bff.rb +1 -0
  245. data/lib/chef/provider/package/cab.rb +4 -2
  246. data/lib/chef/provider/package/chocolatey.rb +5 -2
  247. data/lib/chef/provider/package/dnf.rb +1 -1
  248. data/lib/chef/provider/package/dnf/dnf_helper.py +15 -1
  249. data/lib/chef/provider/package/dnf/python_helper.rb +1 -0
  250. data/lib/chef/provider/package/dpkg.rb +4 -4
  251. data/lib/chef/provider/package/freebsd/base.rb +3 -2
  252. data/lib/chef/provider/package/freebsd/pkgng.rb +2 -2
  253. data/lib/chef/provider/package/homebrew.rb +1 -1
  254. data/lib/chef/provider/package/macports.rb +1 -0
  255. data/lib/chef/provider/package/msu.rb +3 -1
  256. data/lib/chef/provider/package/openbsd.rb +1 -1
  257. data/lib/chef/provider/package/paludis.rb +1 -0
  258. data/lib/chef/provider/package/portage.rb +2 -2
  259. data/lib/chef/provider/package/powershell.rb +3 -2
  260. data/lib/chef/provider/package/rpm.rb +1 -0
  261. data/lib/chef/provider/package/rubygems.rb +5 -3
  262. data/lib/chef/provider/package/smartos.rb +1 -0
  263. data/lib/chef/provider/package/snap.rb +5 -1
  264. data/lib/chef/provider/package/solaris.rb +2 -0
  265. data/lib/chef/provider/package/windows/exe.rb +5 -5
  266. data/lib/chef/provider/package/windows/msi.rb +8 -7
  267. data/lib/chef/provider/package/windows/registry_uninstall_entry.rb +1 -0
  268. data/lib/chef/provider/package/yum.rb +5 -2
  269. data/lib/chef/provider/package/yum/python_helper.rb +2 -1
  270. data/lib/chef/provider/package/zypper.rb +1 -1
  271. data/lib/chef/provider/reboot.rb +1 -1
  272. data/lib/chef/provider/registry_key.rb +2 -2
  273. data/lib/chef/provider/remote_directory.rb +1 -1
  274. data/lib/chef/provider/remote_file.rb +10 -9
  275. data/lib/chef/provider/remote_file/fetcher.rb +3 -2
  276. data/lib/chef/provider/remote_file/local_file.rb +1 -1
  277. data/lib/chef/provider/route.rb +4 -2
  278. data/lib/chef/provider/service/aixinit.rb +1 -1
  279. data/lib/chef/provider/service/arch.rb +2 -1
  280. data/lib/chef/provider/service/debian.rb +12 -11
  281. data/lib/chef/provider/service/freebsd.rb +1 -1
  282. data/lib/chef/provider/service/openbsd.rb +7 -7
  283. data/lib/chef/provider/service/redhat.rb +2 -2
  284. data/lib/chef/provider/service/simple.rb +2 -1
  285. data/lib/chef/provider/service/systemd.rb +2 -2
  286. data/lib/chef/provider/service/upstart.rb +3 -2
  287. data/lib/chef/provider/service/windows.rb +7 -6
  288. data/lib/chef/provider/subversion.rb +4 -1
  289. data/lib/chef/provider/template.rb +1 -0
  290. data/lib/chef/provider/user.rb +5 -1
  291. data/lib/chef/provider/user/aix.rb +3 -0
  292. data/lib/chef/provider/user/dscl.rb +8 -3
  293. data/lib/chef/provider/user/linux.rb +1 -0
  294. data/lib/chef/provider/user/pw.rb +1 -0
  295. data/lib/chef/provider/user/solaris.rb +2 -0
  296. data/lib/chef/provider/user/windows.rb +2 -1
  297. data/lib/chef/provider/windows_env.rb +3 -0
  298. data/lib/chef/provider/windows_script.rb +1 -1
  299. data/lib/chef/provider/windows_task.rb +4 -3
  300. data/lib/chef/provider/yum_repository.rb +1 -2
  301. data/lib/chef/provider/zypper_repository.rb +2 -3
  302. data/lib/chef/recipe.rb +2 -1
  303. data/lib/chef/resource.rb +24 -15
  304. data/lib/chef/resource/apt_package.rb +9 -9
  305. data/lib/chef/resource/apt_preference.rb +9 -9
  306. data/lib/chef/resource/apt_repository.rb +86 -23
  307. data/lib/chef/resource/apt_update.rb +2 -2
  308. data/lib/chef/resource/archive_file.rb +13 -13
  309. data/lib/chef/resource/build_essential.rb +5 -4
  310. data/lib/chef/resource/cab_package.rb +9 -9
  311. data/lib/chef/resource/chef_gem.rb +4 -4
  312. data/lib/chef/resource/chef_handler.rb +8 -7
  313. data/lib/chef/resource/chocolatey_config.rb +3 -3
  314. data/lib/chef/resource/chocolatey_feature.rb +2 -2
  315. data/lib/chef/resource/chocolatey_package.rb +8 -8
  316. data/lib/chef/resource/chocolatey_source.rb +3 -3
  317. data/lib/chef/resource/cookbook_file.rb +4 -4
  318. data/lib/chef/resource/cron.rb +12 -12
  319. data/lib/chef/resource/cron_access.rb +2 -2
  320. data/lib/chef/resource/cron_d.rb +45 -38
  321. data/lib/chef/resource/directory.rb +2 -2
  322. data/lib/chef/resource/dmg_package.rb +26 -26
  323. data/lib/chef/resource/dnf_package.rb +20 -20
  324. data/lib/chef/resource/dpkg_package.rb +5 -5
  325. data/lib/chef/resource/dsc_resource.rb +7 -7
  326. data/lib/chef/resource/dsc_script.rb +9 -4
  327. data/lib/chef/resource/execute.rb +14 -14
  328. data/lib/chef/resource/file.rb +4 -4
  329. data/lib/chef/resource/file/verification.rb +2 -0
  330. data/lib/chef/resource/file/verification/systemd_unit.rb +1 -0
  331. data/lib/chef/resource/gem_package.rb +7 -7
  332. data/lib/chef/resource/git.rb +2 -2
  333. data/lib/chef/resource/group.rb +5 -5
  334. data/lib/chef/resource/homebrew_cask.rb +17 -17
  335. data/lib/chef/resource/homebrew_package.rb +1 -1
  336. data/lib/chef/resource/homebrew_tap.rb +18 -18
  337. data/lib/chef/resource/hostname.rb +11 -11
  338. data/lib/chef/resource/http_request.rb +1 -1
  339. data/lib/chef/resource/ifconfig.rb +26 -26
  340. data/lib/chef/resource/ips_package.rb +2 -2
  341. data/lib/chef/resource/kernel_module.rb +25 -7
  342. data/lib/chef/resource/launchd.rb +105 -105
  343. data/lib/chef/resource/link.rb +10 -10
  344. data/lib/chef/resource/locale.rb +20 -20
  345. data/lib/chef/resource/log.rb +4 -4
  346. data/lib/chef/resource/lwrp_base.rb +1 -0
  347. data/lib/chef/resource/macos_userdefaults.rb +17 -16
  348. data/lib/chef/resource/macosx_service.rb +1 -1
  349. data/lib/chef/resource/mdadm.rb +14 -14
  350. data/lib/chef/resource/mount.rb +24 -24
  351. data/lib/chef/resource/msu_package.rb +8 -8
  352. data/lib/chef/resource/ohai.rb +1 -1
  353. data/lib/chef/resource/ohai_hint.rb +7 -5
  354. data/lib/chef/resource/openssl_dhparam.rb +14 -14
  355. data/lib/chef/resource/openssl_ec_private_key.rb +16 -16
  356. data/lib/chef/resource/openssl_ec_public_key.rb +9 -9
  357. data/lib/chef/resource/openssl_rsa_private_key.rb +17 -17
  358. data/lib/chef/resource/openssl_rsa_public_key.rb +9 -9
  359. data/lib/chef/resource/openssl_x509_certificate.rb +34 -34
  360. data/lib/chef/resource/openssl_x509_crl.rb +17 -17
  361. data/lib/chef/resource/openssl_x509_request.rb +20 -20
  362. data/lib/chef/resource/osx_profile.rb +5 -5
  363. data/lib/chef/resource/package.rb +9 -9
  364. data/lib/chef/resource/paludis_package.rb +2 -2
  365. data/lib/chef/resource/powershell_package.rb +8 -8
  366. data/lib/chef/resource/powershell_package_source.rb +13 -13
  367. data/lib/chef/resource/reboot.rb +4 -4
  368. data/lib/chef/resource/registry_key.rb +5 -3
  369. data/lib/chef/resource/remote_directory.rb +20 -20
  370. data/lib/chef/resource/remote_file.rb +8 -7
  371. data/lib/chef/resource/resource_notification.rb +4 -3
  372. data/lib/chef/resource/rhsm_errata.rb +2 -2
  373. data/lib/chef/resource/rhsm_errata_level.rb +4 -4
  374. data/lib/chef/resource/rhsm_register.rb +14 -14
  375. data/lib/chef/resource/rhsm_repo.rb +3 -3
  376. data/lib/chef/resource/rhsm_subscription.rb +2 -2
  377. data/lib/chef/resource/route.rb +11 -11
  378. data/lib/chef/resource/scm.rb +18 -18
  379. data/lib/chef/resource/service.rb +27 -27
  380. data/lib/chef/resource/snap_package.rb +4 -4
  381. data/lib/chef/resource/ssh_known_hosts_entry.rb +19 -19
  382. data/lib/chef/resource/subversion.rb +10 -10
  383. data/lib/chef/resource/sudo.rb +38 -37
  384. data/lib/chef/resource/swap_file.rb +9 -9
  385. data/lib/chef/resource/sysctl.rb +20 -17
  386. data/lib/chef/resource/systemd_unit.rb +12 -12
  387. data/lib/chef/resource/template.rb +8 -8
  388. data/lib/chef/resource/timezone.rb +3 -2
  389. data/lib/chef/resource/user.rb +19 -19
  390. data/lib/chef/resource/user/dscl_user.rb +2 -2
  391. data/lib/chef/resource/user/windows_user.rb +2 -2
  392. data/lib/chef/resource/windows_ad_join.rb +17 -16
  393. data/lib/chef/resource/windows_auto_run.rb +8 -8
  394. data/lib/chef/resource/windows_certificate.rb +13 -13
  395. data/lib/chef/resource/windows_dfs_folder.rb +13 -12
  396. data/lib/chef/resource/windows_dfs_namespace.rb +18 -18
  397. data/lib/chef/resource/windows_dfs_server.rb +12 -12
  398. data/lib/chef/resource/windows_dns_record.rb +8 -8
  399. data/lib/chef/resource/windows_dns_zone.rb +6 -6
  400. data/lib/chef/resource/windows_env.rb +6 -6
  401. data/lib/chef/resource/windows_feature.rb +12 -12
  402. data/lib/chef/resource/windows_feature_dism.rb +20 -19
  403. data/lib/chef/resource/windows_feature_powershell.rb +24 -22
  404. data/lib/chef/resource/windows_firewall_rule.rb +34 -34
  405. data/lib/chef/resource/windows_font.rb +4 -4
  406. data/lib/chef/resource/windows_package.rb +5 -5
  407. data/lib/chef/resource/windows_pagefile.rb +9 -8
  408. data/lib/chef/resource/windows_path.rb +2 -2
  409. data/lib/chef/resource/windows_printer.rb +15 -15
  410. data/lib/chef/resource/windows_printer_port.rb +14 -14
  411. data/lib/chef/resource/windows_script.rb +1 -1
  412. data/lib/chef/resource/windows_service.rb +16 -16
  413. data/lib/chef/resource/windows_share.rb +27 -24
  414. data/lib/chef/resource/windows_shortcut.rb +7 -7
  415. data/lib/chef/resource/windows_task.rb +53 -51
  416. data/lib/chef/resource/windows_uac.rb +15 -15
  417. data/lib/chef/resource/windows_workgroup.rb +15 -14
  418. data/lib/chef/resource/yum_package.rb +24 -24
  419. data/lib/chef/resource/yum_repository.rb +44 -44
  420. data/lib/chef/resource/zypper_package.rb +9 -9
  421. data/lib/chef/resource/zypper_repository.rb +30 -30
  422. data/lib/chef/resource_builder.rb +1 -0
  423. data/lib/chef/resource_collection.rb +6 -4
  424. data/lib/chef/resource_collection/resource_collection_serialization.rb +4 -3
  425. data/lib/chef/resource_collection/resource_list.rb +5 -3
  426. data/lib/chef/resource_collection/resource_set.rb +12 -8
  427. data/lib/chef/resource_collection/stepable_iterator.rb +1 -0
  428. data/lib/chef/resource_definition.rb +5 -3
  429. data/lib/chef/resource_definition_list.rb +1 -1
  430. data/lib/chef/resource_inspector.rb +1 -1
  431. data/lib/chef/resource_reporter.rb +1 -1
  432. data/lib/chef/role.rb +9 -7
  433. data/lib/chef/run_context.rb +5 -5
  434. data/lib/chef/run_context/cookbook_compiler.rb +5 -1
  435. data/lib/chef/run_list.rb +5 -4
  436. data/lib/chef/run_list/run_list_expansion.rb +3 -2
  437. data/lib/chef/run_list/run_list_item.rb +5 -5
  438. data/lib/chef/run_list/versioned_recipe_list.rb +1 -1
  439. data/lib/chef/run_status.rb +1 -1
  440. data/lib/chef/runner.rb +2 -4
  441. data/lib/chef/search/query.rb +3 -3
  442. data/lib/chef/shell/ext.rb +2 -2
  443. data/lib/chef/shell/model_wrapper.rb +2 -1
  444. data/lib/chef/shell/shell_session.rb +1 -1
  445. data/lib/chef/train_transport.rb +3 -3
  446. data/lib/chef/user.rb +6 -6
  447. data/lib/chef/user_v1.rb +13 -11
  448. data/lib/chef/util/diff.rb +5 -2
  449. data/lib/chef/util/dsc/configuration_generator.rb +6 -6
  450. data/lib/chef/util/dsc/lcm_output_parser.rb +2 -2
  451. data/lib/chef/util/dsc/local_configuration_manager.rb +2 -2
  452. data/lib/chef/util/dsc/resource_store.rb +2 -2
  453. data/lib/chef/util/file_edit.rb +1 -0
  454. data/lib/chef/util/powershell/cmdlet.rb +1 -1
  455. data/lib/chef/util/threaded_job_queue.rb +1 -1
  456. data/lib/chef/util/windows/logon_session.rb +5 -5
  457. data/lib/chef/util/windows/net_use.rb +2 -2
  458. data/lib/chef/util/windows/net_user.rb +3 -2
  459. data/lib/chef/version.rb +1 -1
  460. data/lib/chef/version_class.rb +1 -1
  461. data/lib/chef/version_constraint.rb +1 -1
  462. data/lib/chef/whitelist.rb +1 -1
  463. data/lib/chef/win32/api/crypto.rb +11 -11
  464. data/lib/chef/win32/api/error.rb +4 -4
  465. data/lib/chef/win32/api/file.rb +38 -38
  466. data/lib/chef/win32/api/installer.rb +3 -3
  467. data/lib/chef/win32/api/memory.rb +4 -4
  468. data/lib/chef/win32/api/net.rb +38 -38
  469. data/lib/chef/win32/api/process.rb +2 -2
  470. data/lib/chef/win32/api/psapi.rb +1 -1
  471. data/lib/chef/win32/api/registry.rb +3 -3
  472. data/lib/chef/win32/api/security.rb +87 -87
  473. data/lib/chef/win32/api/synchronization.rb +5 -5
  474. data/lib/chef/win32/api/system.rb +7 -7
  475. data/lib/chef/win32/api/unicode.rb +3 -3
  476. data/lib/chef/win32/eventlog.rb +2 -2
  477. data/lib/chef/win32/file.rb +5 -2
  478. data/lib/chef/win32/file/info.rb +1 -0
  479. data/lib/chef/win32/file/version_info.rb +15 -14
  480. data/lib/chef/win32/memory.rb +1 -1
  481. data/lib/chef/win32/net.rb +8 -4
  482. data/lib/chef/win32/registry.rb +6 -1
  483. data/lib/chef/win32/security.rb +7 -2
  484. data/lib/chef/win32/security/acl.rb +2 -1
  485. data/lib/chef/win32/security/security_descriptor.rb +4 -2
  486. data/lib/chef/win32/security/sid.rb +11 -10
  487. data/lib/chef/win32/security/token.rb +3 -1
  488. data/lib/chef/win32/version.rb +3 -3
  489. data/spec/data/apt/chef-integration-test-1.0/debian/rules +0 -0
  490. data/spec/data/apt/chef-integration-test-1.1/debian/rules +0 -0
  491. data/spec/data/apt/chef-integration-test2-1.0/debian/rules +0 -0
  492. data/spec/functional/assets/chefinittest +0 -0
  493. data/spec/functional/assets/testchefsubsys +0 -0
  494. data/spec/functional/dsl/reboot_pending_spec.rb +2 -2
  495. data/spec/functional/event_loggers/windows_eventlog_spec.rb +6 -4
  496. data/spec/functional/file_content_management/deploy_strategies_spec.rb +21 -21
  497. data/spec/functional/knife/exec_spec.rb +1 -1
  498. data/spec/functional/knife/ssh_spec.rb +3 -3
  499. data/spec/functional/mixin/user_context_spec.rb +3 -1
  500. data/spec/functional/provider/remote_file/cache_control_data_spec.rb +0 -0
  501. data/spec/functional/rebooter_spec.rb +1 -1
  502. data/spec/functional/resource/aix_service_spec.rb +1 -1
  503. data/spec/functional/resource/aixinit_service_spec.rb +1 -1
  504. data/spec/functional/resource/chocolatey_package_spec.rb +2 -2
  505. data/spec/functional/resource/cookbook_file_spec.rb +1 -3
  506. data/spec/functional/resource/cron_spec.rb +1 -0
  507. data/spec/functional/resource/dnf_package_spec.rb +5 -5
  508. data/spec/functional/resource/dpkg_package_spec.rb +4 -4
  509. data/spec/functional/resource/dsc_resource_spec.rb +2 -1
  510. data/spec/functional/resource/dsc_script_spec.rb +7 -11
  511. data/spec/functional/resource/git_spec.rb +5 -5
  512. data/spec/functional/resource/group_spec.rb +15 -13
  513. data/spec/functional/resource/ifconfig_spec.rb +2 -2
  514. data/spec/functional/resource/link_spec.rb +2 -2
  515. data/spec/functional/resource/locale_spec.rb +4 -4
  516. data/spec/functional/resource/mount_spec.rb +3 -3
  517. data/spec/functional/resource/powershell_script_spec.rb +9 -8
  518. data/spec/functional/resource/reboot_spec.rb +1 -1
  519. data/spec/functional/resource/remote_file_spec.rb +2 -2
  520. data/spec/functional/resource/template_spec.rb +1 -1
  521. data/spec/functional/resource/user/windows_spec.rb +2 -2
  522. data/spec/functional/resource/windows_certificate_spec.rb +3 -3
  523. data/spec/functional/resource/windows_service_spec.rb +3 -3
  524. data/spec/functional/run_lock_spec.rb +3 -2
  525. data/spec/functional/util/powershell/cmdlet_spec.rb +1 -1
  526. data/spec/functional/win32/security_spec.rb +12 -7
  527. data/spec/functional/win32/service_manager_spec.rb +1 -1
  528. data/spec/integration/client/client_spec.rb +79 -81
  529. data/spec/integration/client/exit_code_spec.rb +2 -2
  530. data/spec/integration/client/ipv6_spec.rb +2 -2
  531. data/spec/integration/knife/chef_fs_data_store_spec.rb +25 -25
  532. data/spec/integration/knife/chef_repo_path_spec.rb +4 -4
  533. data/spec/integration/knife/config_get_spec.rb +1 -1
  534. data/spec/integration/knife/config_list_profiles_spec.rb +2 -1
  535. data/spec/integration/knife/cookbook_api_ipv6_spec.rb +1 -1
  536. data/spec/integration/knife/cookbook_download_spec.rb +1 -1
  537. data/spec/integration/knife/diff_spec.rb +2 -2
  538. data/spec/integration/knife/download_spec.rb +1 -1
  539. data/spec/integration/knife/redirection_spec.rb +1 -1
  540. data/spec/integration/knife/upload_spec.rb +2 -2
  541. data/spec/integration/recipes/accumulator_spec.rb +4 -4
  542. data/spec/integration/recipes/lwrp_inline_resources_spec.rb +5 -5
  543. data/spec/integration/recipes/lwrp_spec.rb +2 -2
  544. data/spec/integration/recipes/notifies_spec.rb +20 -20
  545. data/spec/integration/recipes/notifying_block_spec.rb +4 -4
  546. data/spec/integration/recipes/provider_choice.rb +1 -2
  547. data/spec/integration/recipes/recipe_dsl_spec.rb +9 -9
  548. data/spec/integration/recipes/remote_directory.rb +2 -2
  549. data/spec/integration/solo/solo_spec.rb +20 -20
  550. data/spec/spec_helper.rb +9 -11
  551. data/spec/stress/win32/security_spec.rb +1 -1
  552. data/spec/support/lib/chef/resource/zen_follower.rb +1 -1
  553. data/spec/support/lib/chef/resource/zen_master.rb +1 -1
  554. data/spec/support/mock/platform.rb +2 -2
  555. data/spec/support/platform_helpers.rb +14 -0
  556. data/spec/support/platforms/win32/spec_service.rb +6 -10
  557. data/spec/support/shared/functional/execute_resource.rb +4 -4
  558. data/spec/support/shared/functional/file_resource.rb +1 -3
  559. data/spec/support/shared/functional/http.rb +15 -39
  560. data/spec/support/shared/functional/securable_resource.rb +4 -8
  561. data/spec/support/shared/functional/win32_service.rb +1 -1
  562. data/spec/support/shared/functional/windows_script.rb +2 -1
  563. data/spec/support/shared/integration/app_server_support.rb +3 -4
  564. data/spec/support/shared/integration/integration_helper.rb +1 -0
  565. data/spec/support/shared/integration/knife_support.rb +5 -5
  566. data/spec/support/shared/unit/application_dot_d.rb +10 -4
  567. data/spec/support/shared/unit/file_system_support.rb +3 -2
  568. data/spec/support/shared/unit/platform_introspector.rb +12 -12
  569. data/spec/support/shared/unit/provider/file.rb +1 -1
  570. data/spec/support/shared/unit/script_resource.rb +1 -1
  571. data/spec/support/shared/unit/windows_script_resource.rb +1 -1
  572. data/spec/tiny_server.rb +1 -1
  573. data/spec/unit/api_client/registration_spec.rb +1 -1
  574. data/spec/unit/api_client_spec.rb +5 -5
  575. data/spec/unit/api_client_v1_spec.rb +6 -6
  576. data/spec/unit/application/client_spec.rb +8 -8
  577. data/spec/unit/application/exit_code_spec.rb +3 -2
  578. data/spec/unit/application/knife_spec.rb +1 -2
  579. data/spec/unit/chef_fs/config_spec.rb +3 -3
  580. data/spec/unit/chef_fs/file_system/repository/directory_spec.rb +1 -1
  581. data/spec/unit/chef_fs/parallelizer.rb +1 -1
  582. data/spec/unit/client_spec.rb +1 -1
  583. data/spec/unit/config_fetcher_spec.rb +1 -1
  584. data/spec/unit/cookbook/metadata_spec.rb +4 -4
  585. data/spec/unit/cookbook/synchronizer_spec.rb +4 -4
  586. data/spec/unit/cookbook_loader_spec.rb +10 -10
  587. data/spec/unit/cookbook_site_streaming_uploader_spec.rb +1 -2
  588. data/spec/unit/cookbook_version_file_specificity_spec.rb +9 -9
  589. data/spec/unit/data_bag_item_spec.rb +8 -8
  590. data/spec/unit/data_bag_spec.rb +1 -1
  591. data/spec/unit/data_collector_spec.rb +82 -0
  592. data/spec/unit/decorator_spec.rb +2 -2
  593. data/spec/unit/deprecated_spec.rb +2 -2
  594. data/spec/unit/dsl/data_query_spec.rb +3 -2
  595. data/spec/unit/dsl/declare_resource_spec.rb +1 -1
  596. data/spec/unit/dsl/platform_introspection_spec.rb +2 -2
  597. data/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb +2 -1
  598. data/spec/unit/encrypted_data_bag_item_spec.rb +2 -1
  599. data/spec/unit/environment_spec.rb +9 -9
  600. data/spec/unit/event_dispatch/dsl_spec.rb +1 -1
  601. data/spec/unit/file_content_management/deploy/mv_unix_spec.rb +3 -3
  602. data/spec/unit/file_content_management/deploy/mv_windows_spec.rb +2 -2
  603. data/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb +3 -3
  604. data/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb +1 -1
  605. data/spec/unit/http/authenticator_spec.rb +3 -2
  606. data/spec/unit/http/json_input_spec.rb +1 -1
  607. data/spec/unit/key_spec.rb +7 -7
  608. data/spec/unit/knife/bootstrap/train_connector_spec.rb +13 -8
  609. data/spec/unit/knife/bootstrap_spec.rb +22 -16
  610. data/spec/unit/knife/client_bulk_delete_spec.rb +4 -4
  611. data/spec/unit/knife/configure_client_spec.rb +1 -1
  612. data/spec/unit/knife/configure_spec.rb +1 -1
  613. data/spec/unit/knife/cookbook_bulk_delete_spec.rb +1 -1
  614. data/spec/unit/knife/cookbook_delete_spec.rb +2 -2
  615. data/spec/unit/knife/cookbook_download_spec.rb +2 -2
  616. data/spec/unit/knife/cookbook_metadata_spec.rb +4 -4
  617. data/spec/unit/knife/cookbook_upload_spec.rb +4 -2
  618. data/spec/unit/knife/core/gem_glob_loader_spec.rb +4 -4
  619. data/spec/unit/knife/core/hashed_command_loader_spec.rb +4 -2
  620. data/spec/unit/knife/core/node_editor_spec.rb +8 -8
  621. data/spec/unit/knife/core/windows_bootstrap_context_spec.rb +1 -2
  622. data/spec/unit/knife/data_bag_from_file_spec.rb +2 -1
  623. data/spec/unit/knife/data_bag_show_spec.rb +2 -1
  624. data/spec/unit/knife/key_create_spec.rb +1 -1
  625. data/spec/unit/knife/key_delete_spec.rb +3 -3
  626. data/spec/unit/knife/key_edit_spec.rb +4 -4
  627. data/spec/unit/knife/key_list_spec.rb +1 -1
  628. data/spec/unit/knife/key_show_spec.rb +3 -3
  629. data/spec/unit/knife/node_bulk_delete_spec.rb +3 -3
  630. data/spec/unit/knife/node_delete_spec.rb +2 -2
  631. data/spec/unit/knife/node_edit_spec.rb +1 -1
  632. data/spec/unit/knife/node_environment_set_spec.rb +6 -1
  633. data/spec/unit/knife/node_from_file_spec.rb +1 -1
  634. data/spec/unit/knife/node_policy_set_spec.rb +1 -1
  635. data/spec/unit/knife/node_run_list_add_spec.rb +1 -1
  636. data/spec/unit/knife/node_run_list_remove_spec.rb +1 -1
  637. data/spec/unit/knife/node_run_list_set_spec.rb +1 -1
  638. data/spec/unit/knife/node_show_spec.rb +1 -1
  639. data/spec/unit/knife/raw_spec.rb +2 -2
  640. data/spec/unit/knife/role_bulk_delete_spec.rb +2 -2
  641. data/spec/unit/knife/role_create_spec.rb +1 -1
  642. data/spec/unit/knife/role_delete_spec.rb +1 -1
  643. data/spec/unit/knife/role_edit_spec.rb +1 -1
  644. data/spec/unit/knife/role_env_run_list_add_spec.rb +1 -1
  645. data/spec/unit/knife/role_env_run_list_clear_spec.rb +1 -1
  646. data/spec/unit/knife/role_env_run_list_remove_spec.rb +1 -1
  647. data/spec/unit/knife/role_env_run_list_replace_spec.rb +1 -1
  648. data/spec/unit/knife/role_env_run_list_set_spec.rb +1 -1
  649. data/spec/unit/knife/role_from_file_spec.rb +1 -1
  650. data/spec/unit/knife/role_run_list_add_spec.rb +1 -1
  651. data/spec/unit/knife/role_run_list_clear_spec.rb +1 -1
  652. data/spec/unit/knife/role_run_list_remove_spec.rb +1 -1
  653. data/spec/unit/knife/role_run_list_replace_spec.rb +1 -1
  654. data/spec/unit/knife/role_run_list_set_spec.rb +1 -1
  655. data/spec/unit/knife/status_spec.rb +2 -1
  656. data/spec/unit/knife/supermarket_install_spec.rb +5 -4
  657. data/spec/unit/knife/supermarket_share_spec.rb +1 -1
  658. data/spec/unit/knife_spec.rb +35 -34
  659. data/spec/unit/lwrp_spec.rb +19 -19
  660. data/spec/unit/mixin/homebrew_user_spec.rb +1 -1
  661. data/spec/unit/mixin/params_validate_spec.rb +10 -10
  662. data/spec/unit/mixin/properties_spec.rb +4 -4
  663. data/spec/unit/mixin/shell_out_spec.rb +3 -3
  664. data/spec/unit/mixin/template_spec.rb +4 -8
  665. data/spec/unit/mixin/unformatter_spec.rb +1 -2
  666. data/spec/unit/mixin/user_context_spec.rb +1 -2
  667. data/spec/unit/mixin/which.rb +2 -0
  668. data/spec/unit/mixin/windows_architecture_helper_spec.rb +3 -3
  669. data/spec/unit/node/attribute_spec.rb +12 -12
  670. data/spec/unit/node/immutable_collections_spec.rb +50 -50
  671. data/spec/unit/node/vivid_mash_spec.rb +4 -4
  672. data/spec/unit/node_spec.rb +12 -12
  673. data/spec/unit/org_spec.rb +3 -3
  674. data/spec/unit/policy_builder/policyfile_spec.rb +2 -2
  675. data/spec/unit/property/state_spec.rb +26 -25
  676. data/spec/unit/property/validation_spec.rb +14 -13
  677. data/spec/unit/property_spec.rb +11 -10
  678. data/spec/unit/provider/apt_update_spec.rb +6 -6
  679. data/spec/unit/provider/cron_spec.rb +1 -1
  680. data/spec/unit/provider/dsc_resource_spec.rb +6 -3
  681. data/spec/unit/provider/dsc_script_spec.rb +1 -1
  682. data/spec/unit/provider/git_spec.rb +38 -38
  683. data/spec/unit/provider/group/dscl_spec.rb +1 -1
  684. data/spec/unit/provider/group/groupadd_spec.rb +1 -1
  685. data/spec/unit/provider/group_spec.rb +2 -3
  686. data/spec/unit/provider/launchd_spec.rb +16 -8
  687. data/spec/unit/provider/link_spec.rb +22 -11
  688. data/spec/unit/provider/mount/mount_spec.rb +31 -31
  689. data/spec/unit/provider/mount/solaris_spec.rb +11 -11
  690. data/spec/unit/provider/ohai_spec.rb +1 -1
  691. data/spec/unit/provider/osx_profile_spec.rb +5 -7
  692. data/spec/unit/provider/package/apt_spec.rb +5 -5
  693. data/spec/unit/provider/package/bff_spec.rb +1 -1
  694. data/spec/unit/provider/package/cab_spec.rb +1 -1
  695. data/spec/unit/provider/package/chocolatey_spec.rb +8 -8
  696. data/spec/unit/provider/package/msu_spec.rb +1 -1
  697. data/spec/unit/provider/package/openbsd_spec.rb +14 -10
  698. data/spec/unit/provider/package/powershell_spec.rb +1 -1
  699. data/spec/unit/provider/package/smartos_spec.rb +2 -2
  700. data/spec/unit/provider/package/windows/exe_spec.rb +9 -9
  701. data/spec/unit/provider/package/windows/msi_spec.rb +7 -7
  702. data/spec/unit/provider/package/windows_spec.rb +2 -1
  703. data/spec/unit/provider/package/yum/yum_cache_spec.rb +1 -1
  704. data/spec/unit/provider/package/zypper_spec.rb +13 -4
  705. data/spec/unit/provider/powershell_script_spec.rb +12 -12
  706. data/spec/unit/provider/registry_key_spec.rb +1 -1
  707. data/spec/unit/provider/remote_directory_spec.rb +6 -6
  708. data/spec/unit/provider/route_spec.rb +11 -11
  709. data/spec/unit/provider/service/arch_service_spec.rb +11 -11
  710. data/spec/unit/provider/service/debian_service_spec.rb +2 -1
  711. data/spec/unit/provider/service/freebsd_service_spec.rb +23 -19
  712. data/spec/unit/provider/service/gentoo_service_spec.rb +2 -2
  713. data/spec/unit/provider/service/init_service_spec.rb +9 -9
  714. data/spec/unit/provider/service/invokercd_service_spec.rb +9 -9
  715. data/spec/unit/provider/service/macosx_spec.rb +1 -1
  716. data/spec/unit/provider/service/openbsd_service_spec.rb +15 -11
  717. data/spec/unit/provider/service/simple_service_spec.rb +5 -5
  718. data/spec/unit/provider/service/upstart_service_spec.rb +14 -14
  719. data/spec/unit/provider/service/windows_spec.rb +53 -35
  720. data/spec/unit/provider/subversion_spec.rb +8 -4
  721. data/spec/unit/provider/systemd_unit_spec.rb +146 -146
  722. data/spec/unit/provider/template/content_spec.rb +28 -28
  723. data/spec/unit/provider/windows_task_spec.rb +7 -2
  724. data/spec/unit/provider_resolver_spec.rb +2 -2
  725. data/spec/unit/provider_spec.rb +2 -4
  726. data/spec/unit/recipe_spec.rb +3 -3
  727. data/spec/unit/resource/batch_spec.rb +1 -1
  728. data/spec/unit/resource/cab_package_spec.rb +1 -1
  729. data/spec/unit/resource/chef_gem_spec.rb +1 -1
  730. data/spec/unit/resource/directory_spec.rb +1 -1
  731. data/spec/unit/resource/dnf_package_spec.rb +1 -1
  732. data/spec/unit/resource/dsc_resource_spec.rb +1 -1
  733. data/spec/unit/resource/file/verification_spec.rb +1 -2
  734. data/spec/unit/resource/file_spec.rb +1 -1
  735. data/spec/unit/resource/group_spec.rb +1 -1
  736. data/spec/unit/resource/kernel_module_spec.rb +1 -0
  737. data/spec/unit/resource/link_spec.rb +1 -1
  738. data/spec/unit/resource/locale_spec.rb +12 -12
  739. data/spec/unit/resource/osx_profile_spec.rb +2 -1
  740. data/spec/unit/resource/powershell_script_spec.rb +12 -7
  741. data/spec/unit/resource/registry_key_spec.rb +3 -3
  742. data/spec/unit/resource/rhsm_repo_spec.rb +6 -0
  743. data/spec/unit/resource/service_spec.rb +1 -1
  744. data/spec/unit/resource/template_spec.rb +2 -2
  745. data/spec/unit/resource/windows_env_spec.rb +1 -1
  746. data/spec/unit/resource/windows_service_spec.rb +7 -7
  747. data/spec/unit/resource/windows_task_spec.rb +2 -2
  748. data/spec/unit/resource/windows_uac_spec.rb +2 -2
  749. data/spec/unit/resource/yum_package_spec.rb +1 -1
  750. data/spec/unit/resource_collection/resource_list_spec.rb +1 -1
  751. data/spec/unit/resource_collection/resource_set_spec.rb +7 -7
  752. data/spec/unit/resource_collection/stepable_iterator_spec.rb +2 -2
  753. data/spec/unit/resource_collection_spec.rb +4 -4
  754. data/spec/unit/resource_definition_spec.rb +2 -2
  755. data/spec/unit/resource_inspector_spec.rb +1 -1
  756. data/spec/unit/resource_reporter_spec.rb +6 -4
  757. data/spec/unit/resource_spec.rb +21 -21
  758. data/spec/unit/role_spec.rb +2 -2
  759. data/spec/unit/run_context/cookbook_compiler_spec.rb +24 -24
  760. data/spec/unit/run_list/run_list_expansion_spec.rb +9 -6
  761. data/spec/unit/run_list_spec.rb +1 -1
  762. data/spec/unit/runner_spec.rb +3 -3
  763. data/spec/unit/search/query_spec.rb +3 -2
  764. data/spec/unit/shell/model_wrapper_spec.rb +1 -1
  765. data/spec/unit/shell/shell_session_spec.rb +8 -11
  766. data/spec/unit/shell_spec.rb +1 -2
  767. data/spec/unit/user_spec.rb +4 -4
  768. data/spec/unit/user_v1_spec.rb +3 -3
  769. data/spec/unit/util/backup_spec.rb +1 -1
  770. data/spec/unit/util/editor_spec.rb +1 -1
  771. data/spec/unit/util/powershell/ps_credential_spec.rb +3 -2
  772. data/spec/unit/util/threaded_job_queue_spec.rb +2 -2
  773. data/spec/unit/version_class_spec.rb +4 -4
  774. data/spec/unit/win32/registry_spec.rb +5 -5
  775. data/spec/unit/win32/security_spec.rb +2 -1
  776. data/tasks/bin/run_external_test +1 -1
  777. data/tasks/docs.rb +78 -61
  778. data/tasks/rspec.rb +1 -1
  779. metadata +5 -33
  780. data/lib/.DS_Store +0 -0
  781. data/lib/chef/.DS_Store +0 -0
  782. data/lib/chef/dsl/.DS_Store +0 -0
  783. data/lib/chef/knife/.DS_Store +0 -0
  784. data/lib/chef/mixin/.DS_Store +0 -0
  785. data/lib/chef/nil_argument.rb +0 -3
  786. data/lib/chef/provider/.DS_Store +0 -0
  787. data/lib/chef/provider/package/.DS_Store +0 -0
  788. data/lib/chef/provider/package/freebsd/.DS_Store +0 -0
  789. data/lib/chef/resource/.DS_Store +0 -0
  790. data/lib/chef/resource/file/.DS_Store +0 -0
  791. data/spec/.DS_Store +0 -0
  792. data/spec/data/.DS_Store +0 -0
  793. data/spec/data/cookbooks/.DS_Store +0 -0
  794. data/spec/data/cookbooks/java/.DS_Store +0 -0
  795. data/spec/data/cookbooks/java/files/.DS_Store +0 -0
  796. data/spec/data/mac_users/.DS_Store +0 -0
  797. data/spec/data/nodes/Tim.local.json +0 -3
  798. data/spec/data/nodes/Tims-MBP.local.json +0 -3
  799. data/spec/data/run_context/.DS_Store +0 -0
  800. data/spec/data/run_context/cookbooks/.DS_Store +0 -0
  801. data/spec/functional/.DS_Store +0 -0
  802. data/spec/functional/resource/.DS_Store +0 -0
  803. data/spec/functional/util/.DS_Store +0 -0
  804. data/spec/integration/.DS_Store +0 -0
  805. data/spec/stress/.DS_Store +0 -0
  806. data/spec/support/.DS_Store +0 -0
  807. data/spec/unit/.DS_Store +0 -0
  808. data/tasks/.DS_Store +0 -0
@@ -879,4 +879,86 @@ describe Chef::DataCollector do
879
879
  data_collector.send(:send_to_file_location, tempfile, { invalid: shift_jis })
880
880
  end
881
881
  end
882
+
883
+ describe "#send_to_datacollector" do
884
+ def stub_http_client(exception = nil)
885
+ if exception.nil?
886
+ expect(http_client).to receive(:post).with(nil, message, data_collector.send(:headers))
887
+ else
888
+ expect(http_client).to receive(:post).with(nil, message, data_collector.send(:headers)).and_raise(exception)
889
+ end
890
+ end
891
+
892
+ let(:message) { "message" }
893
+ let(:http_client) { instance_double(Chef::ServerAPI) }
894
+
895
+ before do
896
+ expect(data_collector).to receive(:setup_http_client).and_return(http_client)
897
+ end
898
+
899
+ it "does not disable the data_collector when no exception is raised" do
900
+ stub_http_client
901
+ expect(data_collector.events).not_to receive(:unregister)
902
+ data_collector.send(:send_to_data_collector, message)
903
+ end
904
+
905
+ errors = [ Timeout::Error, Errno::EINVAL, Errno::ECONNRESET,
906
+ Errno::ECONNREFUSED, EOFError, Net::HTTPBadResponse,
907
+ Net::HTTPHeaderSyntaxError, Net::ProtocolError, OpenSSL::SSL::SSLError,
908
+ Errno::EHOSTDOWN ]
909
+
910
+ errors.each do |exception_class|
911
+ context "when the client raises a #{exception_class} exception" do
912
+ before do
913
+ stub_http_client(exception_class)
914
+ end
915
+
916
+ it "disables the reporter" do
917
+ expect(data_collector.events).to receive(:unregister).with(data_collector)
918
+ data_collector.send(:send_to_data_collector, message)
919
+ end
920
+
921
+ it "logs an error and raises when raise_on_failure is enabled" do
922
+ Chef::Config[:data_collector][:raise_on_failure] = true
923
+ expect(Chef::Log).to receive(:error)
924
+ expect { data_collector.send(:send_to_data_collector, message) }.to raise_error(exception_class)
925
+ end
926
+
927
+ it "logs a warn message and does not raise an exception when raise_on_failure is disabled" do
928
+ Chef::Config[:data_collector][:raise_on_failure] = false
929
+ expect(Chef::Log).to receive(:warn)
930
+ data_collector.send(:send_to_data_collector, message)
931
+ end
932
+ end
933
+ end
934
+
935
+ context "when the client raises a 404 exception" do
936
+ let(:err) do
937
+ response = double("Net::HTTP response", code: "404")
938
+ Net::HTTPClientException.new("Not Found", response)
939
+ end
940
+
941
+ before do
942
+ stub_http_client(err)
943
+ end
944
+
945
+ it "disables the reporter" do
946
+ expect(data_collector.events).to receive(:unregister).with(data_collector)
947
+ data_collector.send(:send_to_data_collector, message)
948
+ end
949
+
950
+ it "logs an error and raises when raise_on_failure is enabled" do
951
+ Chef::Config[:data_collector][:raise_on_failure] = true
952
+ expect(Chef::Log).to receive(:error)
953
+ expect { data_collector.send(:send_to_data_collector, message) }.to raise_error(err)
954
+ end
955
+
956
+ # this is different specifically for 404s
957
+ it "logs an info message and does not raise an exception when raise_on_failure is disabled" do
958
+ Chef::Config[:data_collector][:raise_on_failure] = false
959
+ expect(Chef::Log).to receive(:debug).with(/This is normal if you do not have Chef Automate/)
960
+ data_collector.send(:send_to_data_collector, message)
961
+ end
962
+ end
963
+ end
882
964
  end
@@ -28,11 +28,11 @@ def impersonates_a(klass)
28
28
  end
29
29
 
30
30
  it "#kind_of?(#{klass}) is true" do
31
- expect(decorator.kind_of?(klass)).to be true
31
+ expect(decorator.is_a?(klass)).to be true
32
32
  end
33
33
 
34
34
  it "#kind_of?(Chef::Decorator) is true" do
35
- expect(decorator.kind_of?(Chef::Decorator)).to be true
35
+ expect(decorator.is_a?(Chef::Decorator)).to be true
36
36
  end
37
37
 
38
38
  it "#instance_of?(#{klass}) is false" do
@@ -44,7 +44,7 @@ describe Chef::Deprecated do
44
44
  let(:location) { "the location" }
45
45
 
46
46
  it "displays the full URL" do
47
- expect(TestDeprecation.new().url).to eql("https://docs.chef.io/deprecations_test.html")
47
+ expect(TestDeprecation.new.url).to eql("https://docs.chef.io/deprecations_test.html")
48
48
  end
49
49
 
50
50
  it "formats a complete deprecation message" do
@@ -59,7 +59,7 @@ describe Chef::Deprecated do
59
59
  end
60
60
  collisions = id_map.select { |k, v| v.size != 1 }
61
61
  unless collisions.empty?
62
- raise "Found deprecation ID collisions:\n#{collisions.map { |k, v| "* #{k} #{v.map(&:name).join(', ')}" }.join("\n")}"
62
+ raise "Found deprecation ID collisions:\n#{collisions.map { |k, v| "* #{k} #{v.map(&:name).join(", ")}" }.join("\n")}"
63
63
  end
64
64
  end
65
65
  end
@@ -24,7 +24,7 @@ class DataQueryDSLTester
24
24
  end
25
25
 
26
26
  describe Chef::DSL::DataQuery do
27
- let(:node) { Hash.new }
27
+ let(:node) { {} }
28
28
 
29
29
  let(:language) do
30
30
  language = DataQueryDSLTester.new
@@ -68,7 +68,8 @@ describe Chef::DSL::DataQuery do
68
68
  "a1" => [1, 2, 3],
69
69
  "a2" => { "b1" => true },
70
70
  },
71
- } end
71
+ }
72
+ end
72
73
 
73
74
  let(:item) do
74
75
  item = Chef::DataBagItem.new
@@ -34,7 +34,7 @@ describe Chef::ResourceCollection do
34
34
 
35
35
  describe "mixed in correctly" do
36
36
  it "the resources() method winds up in the right classes" do
37
- methods = [ :resources, :find_resource, :find_resource!, :edit_resource, :edit_resource!, :delete_resource, :delete_resource!, :declare_resource, :build_resource ]
37
+ methods = %i{resources find_resource find_resource! edit_resource edit_resource! delete_resource delete_resource! declare_resource build_resource}
38
38
  expect(Chef::Resource.instance_methods).to include(*methods)
39
39
  expect(Chef::Recipe.instance_methods).to include(*methods)
40
40
  expect(Chef::Provider.instance_methods).to include(*methods)
@@ -40,7 +40,7 @@ describe Chef::DSL::PlatformIntrospection::PlatformDependentValue do
40
40
  before do
41
41
  platform_hash = {
42
42
  :openbsd => { default: "free, functional, secure" },
43
- [:redhat, :centos, :fedora, :scientific] => { default: '"stable"' },
43
+ %i{redhat centos fedora scientific} => { default: '"stable"' },
44
44
  :ubuntu => { "10.04" => "using upstart more", :default => "using init more" },
45
45
  :default => "bork da bork",
46
46
  }
@@ -84,7 +84,7 @@ describe Chef::DSL::PlatformIntrospection::PlatformDependentValue do
84
84
  end
85
85
  describe Chef::DSL::PlatformIntrospection::PlatformFamilyDependentValue do
86
86
  before do
87
- @array_values = [:stop, :start, :reload]
87
+ @array_values = %i{stop start reload}
88
88
 
89
89
  @platform_family_hash = {
90
90
  "debian" => "debian value",
@@ -47,7 +47,8 @@ describe Chef::EncryptedDataBagItem::CheckEncrypted do
47
47
  "a1" => [1, 2, 3],
48
48
  "a2" => { "b1" => true },
49
49
  },
50
- } end
50
+ }
51
+ end
51
52
 
52
53
  let(:version) { 1 }
53
54
  let(:encoded_data) do
@@ -325,7 +325,8 @@ describe Chef::EncryptedDataBagItem do
325
325
  "id" => "item_name",
326
326
  "greeting" => "hello",
327
327
  "nested" => { "a1" => [1, 2, 3], "a2" => { "b1" => true } },
328
- } end
328
+ }
329
+ end
329
330
  let(:secret) { "abc123SECRET" }
330
331
  let(:encoded_data) { subject.encrypt_data_bag_item(plaintext_data, secret) }
331
332
 
@@ -48,8 +48,8 @@ describe Chef::Environment do
48
48
  end
49
49
 
50
50
  it "should not accept anything but strings" do
51
- expect { @environment.name(Array.new) }.to raise_error(ArgumentError)
52
- expect { @environment.name(Hash.new) }.to raise_error(ArgumentError)
51
+ expect { @environment.name([]) }.to raise_error(ArgumentError)
52
+ expect { @environment.name({}) }.to raise_error(ArgumentError)
53
53
  expect { @environment.name(2) }.to raise_error(ArgumentError)
54
54
  end
55
55
  end
@@ -65,8 +65,8 @@ describe Chef::Environment do
65
65
  end
66
66
 
67
67
  it "should not accept anything but strings" do
68
- expect { @environment.description(Array.new) }.to raise_error(ArgumentError)
69
- expect { @environment.description(Hash.new) }.to raise_error(ArgumentError)
68
+ expect { @environment.description([]) }.to raise_error(ArgumentError)
69
+ expect { @environment.description({}) }.to raise_error(ArgumentError)
70
70
  expect { @environment.description(42) }.to raise_error(ArgumentError)
71
71
  end
72
72
  end
@@ -82,7 +82,7 @@ describe Chef::Environment do
82
82
  end
83
83
 
84
84
  it "should throw an ArgumentError if we aren't a kind of hash" do
85
- expect { @environment.default_attributes(Array.new) }.to raise_error(ArgumentError)
85
+ expect { @environment.default_attributes([]) }.to raise_error(ArgumentError)
86
86
  end
87
87
  end
88
88
 
@@ -97,7 +97,7 @@ describe Chef::Environment do
97
97
  end
98
98
 
99
99
  it "should throw an ArgumentError if we aren't a kind of hash" do
100
- expect { @environment.override_attributes(Array.new) }.to raise_error(ArgumentError)
100
+ expect { @environment.override_attributes([]) }.to raise_error(ArgumentError)
101
101
  end
102
102
  end
103
103
 
@@ -121,7 +121,7 @@ describe Chef::Environment do
121
121
 
122
122
  it "should not accept anything but a hash" do
123
123
  expect { @environment.cookbook_versions("I am a string!") }.to raise_error(ArgumentError)
124
- expect { @environment.cookbook_versions(Array.new) }.to raise_error(ArgumentError)
124
+ expect { @environment.cookbook_versions([]) }.to raise_error(ArgumentError)
125
125
  expect { @environment.cookbook_versions(42) }.to raise_error(ArgumentError)
126
126
  end
127
127
 
@@ -257,7 +257,7 @@ describe Chef::Environment do
257
257
  end
258
258
 
259
259
  it "should return false if anything other than a hash is passed as the argument" do
260
- expect(Chef::Environment.validate_cookbook_versions(Array.new)).to eq(false)
260
+ expect(Chef::Environment.validate_cookbook_versions([])).to eq(false)
261
261
  expect(Chef::Environment.validate_cookbook_versions(42)).to eq(false)
262
262
  expect(Chef::Environment.validate_cookbook_versions(Chef::CookbookVersion.new("meta"))).to eq(false)
263
263
  expect(Chef::Environment.validate_cookbook_versions("cookbook => 1.2.3")).to eq(false)
@@ -299,7 +299,7 @@ describe Chef::Environment do
299
299
  expect do
300
300
  Chef::Environment.validate_cookbook_version("= 1.2.3.4")
301
301
  end.to raise_error Chef::Exceptions::IllegalVersionConstraint,
302
- /Environment cookbook version constraints not allowed in .*/
302
+ /Environment cookbook version constraints not allowed in .*/
303
303
  end
304
304
  end
305
305
 
@@ -63,7 +63,7 @@ describe Chef::EventDispatch::DSL do
63
63
  resource = Chef::Resource::RubyBlock.new("foo", run_context)
64
64
  resource.block {}
65
65
  resource.run_action(:run)
66
- expect(calls).to eq([:started, :updated])
66
+ expect(calls).to eq(%i{started updated})
67
67
  end
68
68
 
69
69
  it "preserve instance variables across handler callbacks" do
@@ -38,9 +38,9 @@ describe Chef::FileContentManagement::Deploy::MvUnix do
38
38
  let(:target_file_mode) { 0644 }
39
39
  let(:target_file_stat) do
40
40
  double "File::Stat struct for target file",
41
- mode: target_file_mode,
42
- uid: target_file_uid,
43
- gid: target_file_gid
41
+ mode: target_file_mode,
42
+ uid: target_file_uid,
43
+ gid: target_file_gid
44
44
  end
45
45
 
46
46
  before do
@@ -84,8 +84,8 @@ describe Chef::FileContentManagement::Deploy::MvWindows do
84
84
 
85
85
  let(:target_file_security_descriptor) do
86
86
  double "security descriptor for target file",
87
- group: original_target_file_group,
88
- owner: original_target_file_owner
87
+ group: original_target_file_group,
88
+ owner: original_target_file_owner
89
89
  end
90
90
 
91
91
  let(:updated_target_security_descriptor) do
@@ -60,7 +60,7 @@ describe Chef::Formatters::ErrorInspectors::ResourceFailureInspector do
60
60
  @trace = [
61
61
  "/var/chef/cache/cookbooks/syntax-err/recipes/default.rb:14:in `from_file'",
62
62
  "/var/chef/cache/cookbooks/syntax-err/recipes/default.rb:11:in `from_file'",
63
- "/usr/local/lib/ruby/gems/chef/lib/chef/client.rb:123:in `run'" # should not display
63
+ "/usr/local/lib/ruby/gems/chef/lib/chef/client.rb:123:in `run'", # should not display
64
64
  ]
65
65
  @exception = Chef::Exceptions::Package.new("No such package 'non-existing-package'")
66
66
  @exception.set_backtrace(@trace)
@@ -122,7 +122,7 @@ describe Chef::Formatters::ErrorInspectors::ResourceFailureInspector do
122
122
  source_line = "C:/Users/btm/chef/chef/spec/unit/fake_file.rb:2: undefined local variable or method `non_existent' for main:Object (NameError)"
123
123
  @resource.source_line = source_line
124
124
  @inspector = Chef::Formatters::ErrorInspectors::ResourceFailureInspector.new(@resource, :create, @exception)
125
- expect(@inspector.recipe_snippet).to match(/^# In C:\/Users\/btm/)
125
+ expect(@inspector.recipe_snippet).to match(%r{^# In C:/Users/btm})
126
126
  end
127
127
 
128
128
  it "parses a Windows path" do
@@ -136,7 +136,7 @@ describe Chef::Formatters::ErrorInspectors::ResourceFailureInspector do
136
136
  source_line = "/home/btm/src/chef/chef/spec/unit/fake_file.rb:2: undefined local variable or method `non_existent' for main:Object (NameError)"
137
137
  @resource.source_line = source_line
138
138
  @inspector = Chef::Formatters::ErrorInspectors::ResourceFailureInspector.new(@resource, :create, @exception)
139
- expect(@inspector.recipe_snippet).to match(/^# In \/home\/btm/)
139
+ expect(@inspector.recipe_snippet).to match(%r{^# In /home/btm})
140
140
  end
141
141
 
142
142
  context "when the recipe file does not exist" do
@@ -22,7 +22,7 @@ describe Chef::GuardInterpreter::ResourceGuardInterpreter do
22
22
  let(:node) do
23
23
  node = Chef::Node.new
24
24
 
25
- node.default["kernel"] = Hash.new
25
+ node.default["kernel"] = {}
26
26
  node.default["kernel"][:machine] = :x86_64.to_s
27
27
  node.automatic[:os] = "windows"
28
28
  node
@@ -23,7 +23,7 @@ describe Chef::HTTP::Authenticator do
23
23
  let(:class_instance) { Chef::HTTP::Authenticator.new(client_name: "test") }
24
24
  let(:method) { "GET" }
25
25
  let(:url) { URI("https://chef.example.com/organizations/test") }
26
- let(:headers) { Hash.new }
26
+ let(:headers) { {} }
27
27
  let(:data) { "" }
28
28
 
29
29
  context "when handle_request is called" do
@@ -92,7 +92,8 @@ describe Chef::HTTP::Authenticator do
92
92
  it "calls authentication_headers with the proper input" do
93
93
  expect(class_instance).to receive(:authentication_headers).with(
94
94
  method, url, data,
95
- { "X-Ops-Server-API-Version" => Chef::HTTP::Authenticator::DEFAULT_SERVER_API_VERSION }).and_return({})
95
+ { "X-Ops-Server-API-Version" => Chef::HTTP::Authenticator::DEFAULT_SERVER_API_VERSION }
96
+ ).and_return({})
96
97
  class_instance.handle_request(method, url, headers, data)
97
98
  end
98
99
  end
@@ -21,7 +21,7 @@ require "chef/http/json_input"
21
21
 
22
22
  describe Chef::HTTP::JSONInput do
23
23
 
24
- let(:json_encoder) { described_class.new() }
24
+ let(:json_encoder) { described_class.new }
25
25
 
26
26
  let(:url) { URI.parse("http://example.com") }
27
27
  let(:headers) { {} }
@@ -66,7 +66,7 @@ describe Chef::Key do
66
66
 
67
67
  context "when you feed it anything but a string" do
68
68
  it "should raise an ArgumentError" do
69
- expect { key.send(field, Hash.new) }.to raise_error(ArgumentError)
69
+ expect { key.send(field, {}) }.to raise_error(ArgumentError)
70
70
  end
71
71
  end
72
72
  end
@@ -406,9 +406,9 @@ describe Chef::Key do
406
406
 
407
407
  it "creates a new key via the API with the fingerprint as the name" do
408
408
  expect(rest).to receive(:post).with(url,
409
- { "name" => "12:3e:33:73:0b:f4:ec:72:dc:f0:4c:51:62:27:08:76:96:24:f4:4a",
410
- "public_key" => key.public_key,
411
- "expiration_date" => key.expiration_date }).and_return({})
409
+ { "name" => "12:3e:33:73:0b:f4:ec:72:dc:f0:4c:51:62:27:08:76:96:24:f4:4a",
410
+ "public_key" => key.public_key,
411
+ "expiration_date" => key.expiration_date }).and_return({})
412
412
  key.create
413
413
  end
414
414
  end
@@ -424,9 +424,9 @@ describe Chef::Key do
424
424
  context "when create_key is false" do
425
425
  it "creates a new key via the API" do
426
426
  expect(rest).to receive(:post).with(url,
427
- { "name" => key.name,
428
- "public_key" => key.public_key,
429
- "expiration_date" => key.expiration_date }).and_return({})
427
+ { "name" => key.name,
428
+ "public_key" => key.public_key,
429
+ "expiration_date" => key.expiration_date }).and_return({})
430
430
  key.create
431
431
  end
432
432
  end
@@ -155,21 +155,26 @@ describe Chef::Knife::Bootstrap::TrainConnector do
155
155
  context "under linux and unix-like" do
156
156
  let(:family) { "debian" }
157
157
  let(:name) { "ubuntu" }
158
+ let(:random) { "wScHX6" }
159
+ let(:dir) { "/tmp/chef_#{random}" }
160
+
161
+ before do
162
+ allow(SecureRandom).to receive(:alphanumeric).with(6).and_return(random)
163
+ end
164
+
158
165
  it "uses the *nix command to create the temp dir and sets ownership to logged-in user" do
159
- expected_command = Chef::Knife::Bootstrap::TrainConnector::MKTEMP_NIX_COMMAND
166
+ expected_command = "mkdir -p #{dir} && sudo chown user1 '#{dir}'"
160
167
  expect(subject).to receive(:run_command!).with(expected_command)
161
- .and_return double("result", stdout: "/a/path")
162
- expect(subject).to receive(:run_command!).with("chown user1 '/a/path'")
163
- expect(subject.temp_dir).to eq "/a/path"
168
+ .and_return double("result", stdout: "\r\n")
169
+ expect(subject.temp_dir).to eq(dir)
164
170
  end
165
171
 
166
172
  context "with noise in stderr" do
167
173
  it "uses the *nix command to create the temp dir and sets ownership to logged-in user" do
168
- expected_command = Chef::Knife::Bootstrap::TrainConnector::MKTEMP_NIX_COMMAND
174
+ expected_command = "mkdir -p #{dir} && sudo chown user1 '#{dir}'"
169
175
  expect(subject).to receive(:run_command!).with(expected_command)
170
- .and_return double("result", stdout: "sudo: unable to resolve host hostname.localhost\r\n" + "/a/path\r\n")
171
- expect(subject).to receive(:run_command!).with("chown user1 '/a/path'")
172
- expect(subject.temp_dir).to eq "/a/path"
176
+ .and_return double("result", stdout: "sudo: unable to resolve host hostname.localhost\r\n" + "#{dir}\r\n")
177
+ expect(subject.temp_dir).to eq(dir)
173
178
  end
174
179
  end
175
180
  end
@@ -33,9 +33,10 @@ describe Chef::Knife::Bootstrap do
33
33
 
34
34
  let(:connection) do
35
35
  double("TrainConnector",
36
- windows?: windows_test,
37
- linux?: linux_test,
38
- unix?: unix_test) end
36
+ windows?: windows_test,
37
+ linux?: linux_test,
38
+ unix?: unix_test)
39
+ end
39
40
 
40
41
  let(:knife) do
41
42
  Chef::Log.logger = Logger.new(StringIO.new)
@@ -107,7 +108,7 @@ describe Chef::Knife::Bootstrap do
107
108
  expect(knife).to receive(:read_secret).and_return("secrets")
108
109
  expect(rendered_template).to match("cat > /etc/chef/encrypted_data_bag_secret <<'EOP'")
109
110
  expect(rendered_template).to match('{"run_list":\[\]}')
110
- expect(rendered_template).to match(%r{secrets})
111
+ expect(rendered_template).to match(/secrets/)
111
112
  end
112
113
  end
113
114
  end
@@ -127,7 +128,7 @@ describe Chef::Knife::Bootstrap do
127
128
  knife.render_template
128
129
  end
129
130
  it "configures the preinstall command in the bootstrap template correctly" do
130
- expect(rendered_template).to match(%r{command})
131
+ expect(rendered_template).to match(/command/)
131
132
  end
132
133
  end
133
134
 
@@ -138,7 +139,7 @@ describe Chef::Knife::Bootstrap do
138
139
  knife.render_template
139
140
  end
140
141
  it "configures the https_proxy environment variable in the bootstrap template correctly" do
141
- expect(rendered_template).to match(%r{https_proxy="1.1.1.1" export https_proxy})
142
+ expect(rendered_template).to match(/https_proxy="1.1.1.1" export https_proxy/)
142
143
  end
143
144
  end
144
145
 
@@ -149,7 +150,7 @@ describe Chef::Knife::Bootstrap do
149
150
  knife.render_template
150
151
  end
151
152
  it "configures the https_proxy environment variable in the bootstrap template correctly" do
152
- expect(rendered_template).to match(%r{no_proxy="localserver" export no_proxy})
153
+ expect(rendered_template).to match(/no_proxy="localserver" export no_proxy/)
153
154
  end
154
155
  end
155
156
 
@@ -360,7 +361,7 @@ describe Chef::Knife::Bootstrap do
360
361
  it "should create a hint file when told to" do
361
362
  knife.parse_options(["--hint", "openstack"])
362
363
  knife.merge_configs
363
- expect(knife.render_template).to match(/\/etc\/chef\/ohai\/hints\/openstack.json/)
364
+ expect(knife.render_template).to match(%r{/etc/chef/ohai/hints/openstack.json})
364
365
  end
365
366
 
366
367
  it "should populate a hint file with JSON when given a file to read" do
@@ -393,7 +394,7 @@ describe Chef::Knife::Bootstrap do
393
394
  let(:setting) { "api.opscode.com" }
394
395
 
395
396
  it "renders the client.rb with a single FQDN no_proxy entry" do
396
- expect(rendered_template).to match(%r{.*no_proxy\s*"api.opscode.com".*})
397
+ expect(rendered_template).to match(/.*no_proxy\s*"api.opscode.com".*/)
397
398
  end
398
399
  end
399
400
 
@@ -401,7 +402,7 @@ describe Chef::Knife::Bootstrap do
401
402
  let(:setting) { "api.opscode.com,172.16.10.*" }
402
403
 
403
404
  it "renders the client.rb with comma-separated FQDN and wildcard IP address no_proxy entries" do
404
- expect(rendered_template).to match(%r{.*no_proxy\s*"api.opscode.com,172.16.10.\*".*})
405
+ expect(rendered_template).to match(/.*no_proxy\s*"api.opscode.com,172.16.10.\*".*/)
405
406
  end
406
407
  end
407
408
 
@@ -459,7 +460,7 @@ describe Chef::Knife::Bootstrap do
459
460
  it "creates a secret file" do
460
461
  expect(knife).to receive(:encryption_secret_provided_ignore_encrypt_flag?).and_return(true)
461
462
  expect(knife).to receive(:read_secret).and_return(secret)
462
- expect(rendered_template).to match(%r{#{secret}})
463
+ expect(rendered_template).to match(/#{secret}/)
463
464
  end
464
465
 
465
466
  it "renders the client.rb with an encrypted_data_bag_secret entry" do
@@ -569,7 +570,9 @@ describe Chef::Knife::Bootstrap do
569
570
  context "when client_d_dir is set" do
570
571
  let(:client_d_dir) do
571
572
  Chef::Util::PathHelper.cleanpath(
572
- File.join(File.dirname(__FILE__), "../../data/client.d_00")) end
573
+ File.join(File.dirname(__FILE__), "../../data/client.d_00")
574
+ )
575
+ end
573
576
 
574
577
  it "creates /etc/chef/client.d" do
575
578
  expect(rendered_template).to match("mkdir -p /etc/chef/client\.d")
@@ -594,7 +597,9 @@ describe Chef::Knife::Bootstrap do
594
597
  context "a nested directory structure" do
595
598
  let(:client_d_dir) do
596
599
  Chef::Util::PathHelper.cleanpath(
597
- File.join(File.dirname(__FILE__), "../../data/client.d_01")) end
600
+ File.join(File.dirname(__FILE__), "../../data/client.d_01")
601
+ )
602
+ end
598
603
  it "creates a file foo/bar.rb" do
599
604
  expect(rendered_template).to match("cat > /etc/chef/client.d/foo/bar.rb <<'EOP'")
600
605
  expect(rendered_template).to match("1 / 0")
@@ -1554,7 +1559,8 @@ describe Chef::Knife::Bootstrap do
1554
1559
  ssl: false,
1555
1560
  ssl_peer_fingerprint: nil,
1556
1561
  operation_timeout: 60,
1557
- } end
1562
+ }
1563
+ end
1558
1564
 
1559
1565
  it "generates a correct configuration hash with expected defaults" do
1560
1566
  expect(knife.winrm_opts).to eq expected
@@ -1730,7 +1736,7 @@ describe Chef::Knife::Bootstrap do
1730
1736
  before do
1731
1737
  Chef::Config[:validation_key] = "/blah"
1732
1738
  allow(vault_handler_mock).to receive(:doing_chef_vault?).and_return false
1733
- allow(File).to receive(:exist?).with(/\/blah/).and_return false
1739
+ allow(File).to receive(:exist?).with(%r{/blah}).and_return false
1734
1740
  end
1735
1741
  it_behaves_like "creating the client locally"
1736
1742
  end
@@ -1738,7 +1744,7 @@ describe Chef::Knife::Bootstrap do
1738
1744
  context "when a valid validation key is given and we're doing old-style client creation" do
1739
1745
  before do
1740
1746
  Chef::Config[:validation_key] = "/blah"
1741
- allow(File).to receive(:exist?).with(/\/blah/).and_return true
1747
+ allow(File).to receive(:exist?).with(%r{/blah}).and_return true
1742
1748
  allow(vault_handler_mock).to receive(:doing_chef_vault?).and_return false
1743
1749
  end
1744
1750