chef 17.10.163 → 18.0.169

Sign up to get free protection for your applications and to get access to all the features.
Files changed (330) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +19 -20
  3. data/README.md +7 -7
  4. data/Rakefile +3 -22
  5. data/{chef-universal-mingw32.gemspec → chef-universal-mingw-ucrt.gemspec} +8 -7
  6. data/chef.gemspec +17 -15
  7. data/lib/chef/api_client_v1.rb +9 -1
  8. data/lib/chef/application/exit_code.rb +3 -3
  9. data/lib/chef/client.rb +182 -0
  10. data/lib/chef/compliance/input.rb +1 -1
  11. data/lib/chef/compliance/profile.rb +1 -1
  12. data/lib/chef/compliance/profile_collection.rb +0 -1
  13. data/lib/chef/compliance/waiver.rb +1 -1
  14. data/lib/chef/cookbook/syntax_check.rb +2 -2
  15. data/lib/chef/dsl/reader_helpers.rb +1 -1
  16. data/lib/chef/dsl/rest_resource.rb +77 -0
  17. data/lib/chef/event_dispatch/base.rb +3 -0
  18. data/lib/chef/exceptions.rb +8 -0
  19. data/lib/chef/http/authenticator.rb +170 -3
  20. data/lib/chef/http/ssl_policies.rb +4 -4
  21. data/lib/chef/mixin/checksum.rb +0 -6
  22. data/lib/chef/mixin/homebrew_user.rb +5 -15
  23. data/lib/chef/mixin/openssl_helper.rb +13 -17
  24. data/lib/chef/mixin/powershell_exec.rb +5 -28
  25. data/lib/chef/node/mixin/immutablize_array.rb +1 -0
  26. data/lib/chef/property.rb +5 -3
  27. data/lib/chef/provider/cron.rb +1 -5
  28. data/lib/chef/provider/file.rb +2 -2
  29. data/lib/chef/provider/group/windows.rb +1 -1
  30. data/lib/chef/provider/http_request.rb +11 -9
  31. data/lib/chef/provider/mount/linux.rb +5 -0
  32. data/lib/chef/provider/mount/mount.rb +8 -0
  33. data/lib/chef/provider/mount/windows.rb +1 -1
  34. data/lib/chef/provider/package/chocolatey.rb +1 -14
  35. data/lib/chef/provider/package/rubygems.rb +1 -1
  36. data/lib/chef/provider/package/windows/msi.rb +2 -2
  37. data/lib/chef/provider/package/windows/registry_uninstall_entry.rb +1 -1
  38. data/lib/chef/provider/package/windows.rb +1 -1
  39. data/lib/chef/provider/package/yum/yum_helper.py +14 -2
  40. data/lib/chef/provider/package/zypper/version.rb +60 -0
  41. data/lib/chef/provider/package/zypper.rb +47 -8
  42. data/lib/chef/provider/service/windows.rb +1 -1
  43. data/lib/chef/provider/user/aix.rb +5 -0
  44. data/lib/chef/provider/user/linux.rb +29 -0
  45. data/lib/chef/provider/user/mac.rb +1 -1
  46. data/lib/chef/provider/user.rb +46 -14
  47. data/lib/chef/provider.rb +1 -1
  48. data/lib/chef/recipe.rb +1 -1
  49. data/lib/chef/resource/_rest_resource.rb +389 -0
  50. data/lib/chef/resource/alternatives.rb +0 -1
  51. data/lib/chef/resource/apt_package.rb +0 -1
  52. data/lib/chef/resource/apt_preference.rb +0 -1
  53. data/lib/chef/resource/apt_repository.rb +0 -1
  54. data/lib/chef/resource/apt_update.rb +0 -1
  55. data/lib/chef/resource/archive_file.rb +0 -1
  56. data/lib/chef/resource/bash.rb +0 -1
  57. data/lib/chef/resource/batch.rb +0 -1
  58. data/lib/chef/resource/bff_package.rb +0 -1
  59. data/lib/chef/resource/breakpoint.rb +0 -1
  60. data/lib/chef/resource/build_essential.rb +0 -1
  61. data/lib/chef/resource/cab_package.rb +0 -1
  62. data/lib/chef/resource/chef_client_config.rb +14 -18
  63. data/lib/chef/resource/chef_client_cron.rb +1 -2
  64. data/lib/chef/resource/chef_client_launchd.rb +2 -2
  65. data/lib/chef/resource/chef_client_scheduled_task.rb +3 -3
  66. data/lib/chef/resource/chef_client_systemd_timer.rb +1 -2
  67. data/lib/chef/resource/chef_client_trusted_certificate.rb +0 -1
  68. data/lib/chef/resource/chef_gem.rb +0 -1
  69. data/lib/chef/resource/chef_handler.rb +0 -1
  70. data/lib/chef/resource/chef_sleep.rb +1 -3
  71. data/lib/chef/resource/chef_vault_secret.rb +0 -1
  72. data/lib/chef/resource/chocolatey_config.rb +0 -1
  73. data/lib/chef/resource/chocolatey_feature.rb +0 -1
  74. data/lib/chef/resource/chocolatey_package.rb +0 -1
  75. data/lib/chef/resource/chocolatey_source.rb +0 -1
  76. data/lib/chef/resource/cookbook_file.rb +0 -1
  77. data/lib/chef/resource/cron/_cron_shared.rb +0 -1
  78. data/lib/chef/resource/cron/cron.rb +0 -1
  79. data/lib/chef/resource/cron/cron_d.rb +15 -1
  80. data/lib/chef/resource/cron_access.rb +0 -1
  81. data/lib/chef/resource/csh.rb +0 -1
  82. data/lib/chef/resource/directory.rb +0 -1
  83. data/lib/chef/resource/dmg_package.rb +0 -1
  84. data/lib/chef/resource/dnf_package.rb +0 -1
  85. data/lib/chef/resource/dpkg_package.rb +0 -1
  86. data/lib/chef/resource/dsc_resource.rb +0 -1
  87. data/lib/chef/resource/dsc_script.rb +0 -1
  88. data/lib/chef/resource/execute.rb +0 -1
  89. data/lib/chef/resource/file.rb +0 -1
  90. data/lib/chef/resource/freebsd_package.rb +0 -1
  91. data/lib/chef/resource/gem_package.rb +0 -1
  92. data/lib/chef/resource/group.rb +25 -2
  93. data/lib/chef/resource/habitat/habitat_package.rb +0 -1
  94. data/lib/chef/resource/habitat/habitat_sup.rb +6 -7
  95. data/lib/chef/resource/habitat/habitat_sup_windows.rb +1 -1
  96. data/lib/chef/resource/habitat_config.rb +0 -1
  97. data/lib/chef/resource/habitat_install.rb +0 -1
  98. data/lib/chef/resource/habitat_service.rb +0 -1
  99. data/lib/chef/resource/habitat_user_toml.rb +0 -1
  100. data/lib/chef/resource/homebrew_cask.rb +8 -8
  101. data/lib/chef/resource/homebrew_package.rb +1 -2
  102. data/lib/chef/resource/homebrew_tap.rb +5 -6
  103. data/lib/chef/resource/homebrew_update.rb +0 -2
  104. data/lib/chef/resource/hostname.rb +0 -1
  105. data/lib/chef/resource/http_request.rb +0 -1
  106. data/lib/chef/resource/ifconfig.rb +0 -1
  107. data/lib/chef/resource/inspec_input.rb +0 -1
  108. data/lib/chef/resource/inspec_waiver.rb +0 -1
  109. data/lib/chef/resource/inspec_waiver_file_entry.rb +2 -3
  110. data/lib/chef/resource/ips_package.rb +0 -1
  111. data/lib/chef/resource/kernel_module.rb +0 -1
  112. data/lib/chef/resource/ksh.rb +0 -1
  113. data/lib/chef/resource/launchd.rb +0 -1
  114. data/lib/chef/resource/link.rb +0 -1
  115. data/lib/chef/resource/locale.rb +2 -6
  116. data/lib/chef/resource/log.rb +0 -1
  117. data/lib/chef/resource/lwrp_base.rb +0 -4
  118. data/lib/chef/resource/macos_userdefaults.rb +5 -10
  119. data/lib/chef/resource/macosx_service.rb +0 -1
  120. data/lib/chef/resource/macports_package.rb +0 -1
  121. data/lib/chef/resource/mdadm.rb +0 -1
  122. data/lib/chef/resource/mount.rb +0 -1
  123. data/lib/chef/resource/msu_package.rb +0 -1
  124. data/lib/chef/resource/notify_group.rb +0 -2
  125. data/lib/chef/resource/ohai.rb +0 -1
  126. data/lib/chef/resource/ohai_hint.rb +0 -1
  127. data/lib/chef/resource/openbsd_package.rb +0 -1
  128. data/lib/chef/resource/openssl_dhparam.rb +0 -2
  129. data/lib/chef/resource/openssl_ec_private_key.rb +0 -2
  130. data/lib/chef/resource/openssl_ec_public_key.rb +0 -2
  131. data/lib/chef/resource/openssl_rsa_private_key.rb +0 -2
  132. data/lib/chef/resource/openssl_rsa_public_key.rb +0 -2
  133. data/lib/chef/resource/openssl_x509_certificate.rb +0 -2
  134. data/lib/chef/resource/openssl_x509_crl.rb +0 -2
  135. data/lib/chef/resource/openssl_x509_request.rb +0 -2
  136. data/lib/chef/resource/osx_profile.rb +0 -1
  137. data/lib/chef/resource/package.rb +0 -1
  138. data/lib/chef/resource/pacman_package.rb +0 -1
  139. data/lib/chef/resource/paludis_package.rb +0 -1
  140. data/lib/chef/resource/perl.rb +0 -1
  141. data/lib/chef/resource/plist.rb +7 -3
  142. data/lib/chef/resource/portage_package.rb +0 -1
  143. data/lib/chef/resource/powershell_package.rb +0 -1
  144. data/lib/chef/resource/powershell_package_source.rb +0 -1
  145. data/lib/chef/resource/powershell_script.rb +0 -1
  146. data/lib/chef/resource/python.rb +0 -1
  147. data/lib/chef/resource/reboot.rb +0 -1
  148. data/lib/chef/resource/registry_key.rb +0 -1
  149. data/lib/chef/resource/remote_directory.rb +0 -1
  150. data/lib/chef/resource/remote_file.rb +0 -1
  151. data/lib/chef/resource/rhsm_errata.rb +0 -1
  152. data/lib/chef/resource/rhsm_errata_level.rb +0 -1
  153. data/lib/chef/resource/rhsm_register.rb +0 -3
  154. data/lib/chef/resource/rhsm_repo.rb +0 -1
  155. data/lib/chef/resource/rhsm_subscription.rb +0 -1
  156. data/lib/chef/resource/route.rb +0 -1
  157. data/lib/chef/resource/rpm_package.rb +0 -1
  158. data/lib/chef/resource/ruby.rb +0 -1
  159. data/lib/chef/resource/ruby_block.rb +0 -1
  160. data/lib/chef/resource/scm/_scm.rb +0 -2
  161. data/lib/chef/resource/scm/git.rb +0 -2
  162. data/lib/chef/resource/scm/subversion.rb +0 -2
  163. data/lib/chef/resource/script.rb +0 -1
  164. data/lib/chef/resource/selinux/common_helpers.rb +47 -0
  165. data/lib/chef/resource/selinux/selinux_debian.erb +18 -0
  166. data/lib/chef/resource/selinux/selinux_default.erb +15 -0
  167. data/lib/chef/resource/selinux_boolean.rb +101 -0
  168. data/lib/chef/resource/selinux_fcontext.rb +160 -0
  169. data/lib/chef/resource/selinux_install.rb +107 -0
  170. data/lib/chef/resource/selinux_module.rb +143 -0
  171. data/lib/chef/resource/selinux_permissive.rb +64 -0
  172. data/lib/chef/resource/selinux_port.rb +118 -0
  173. data/lib/chef/resource/selinux_state.rb +166 -0
  174. data/lib/chef/resource/service.rb +0 -1
  175. data/lib/chef/resource/smartos_package.rb +0 -1
  176. data/lib/chef/resource/snap_package.rb +0 -1
  177. data/lib/chef/resource/solaris_package.rb +0 -1
  178. data/lib/chef/resource/ssh_known_hosts_entry.rb +0 -1
  179. data/lib/chef/resource/sudo.rb +0 -1
  180. data/lib/chef/resource/support/client.erb +5 -6
  181. data/lib/chef/resource/swap_file.rb +0 -1
  182. data/lib/chef/resource/sysctl.rb +1 -2
  183. data/lib/chef/resource/systemd_unit.rb +0 -1
  184. data/lib/chef/resource/template.rb +0 -1
  185. data/lib/chef/resource/timezone.rb +0 -1
  186. data/lib/chef/resource/user/aix_user.rb +0 -1
  187. data/lib/chef/resource/user/linux_user.rb +0 -1
  188. data/lib/chef/resource/user/mac_user.rb +0 -1
  189. data/lib/chef/resource/user/pw_user.rb +0 -1
  190. data/lib/chef/resource/user/solaris_user.rb +0 -1
  191. data/lib/chef/resource/user/windows_user.rb +0 -1
  192. data/lib/chef/resource/user.rb +10 -1
  193. data/lib/chef/resource/user_ulimit.rb +0 -1
  194. data/lib/chef/resource/whyrun_safe_ruby_block.rb +0 -1
  195. data/lib/chef/resource/windows_ad_join.rb +0 -2
  196. data/lib/chef/resource/windows_audit_policy.rb +0 -2
  197. data/lib/chef/resource/windows_auto_run.rb +0 -1
  198. data/lib/chef/resource/windows_defender.rb +0 -1
  199. data/lib/chef/resource/windows_defender_exclusion.rb +0 -1
  200. data/lib/chef/resource/windows_dfs_folder.rb +0 -1
  201. data/lib/chef/resource/windows_dfs_namespace.rb +0 -1
  202. data/lib/chef/resource/windows_dfs_server.rb +0 -1
  203. data/lib/chef/resource/windows_dns_record.rb +0 -1
  204. data/lib/chef/resource/windows_dns_zone.rb +0 -1
  205. data/lib/chef/resource/windows_env.rb +0 -1
  206. data/lib/chef/resource/windows_feature.rb +0 -1
  207. data/lib/chef/resource/windows_feature_dism.rb +0 -1
  208. data/lib/chef/resource/windows_feature_powershell.rb +0 -1
  209. data/lib/chef/resource/windows_firewall_profile.rb +0 -2
  210. data/lib/chef/resource/windows_firewall_rule.rb +0 -1
  211. data/lib/chef/resource/windows_font.rb +2 -3
  212. data/lib/chef/resource/windows_package.rb +0 -1
  213. data/lib/chef/resource/windows_pagefile.rb +0 -2
  214. data/lib/chef/resource/windows_path.rb +0 -1
  215. data/lib/chef/resource/windows_printer.rb +0 -1
  216. data/lib/chef/resource/windows_printer_port.rb +0 -1
  217. data/lib/chef/resource/windows_script.rb +0 -2
  218. data/lib/chef/resource/windows_security_policy.rb +0 -1
  219. data/lib/chef/resource/windows_service.rb +0 -1
  220. data/lib/chef/resource/windows_share.rb +0 -1
  221. data/lib/chef/resource/windows_shortcut.rb +1 -2
  222. data/lib/chef/resource/windows_task.rb +0 -1
  223. data/lib/chef/resource/windows_uac.rb +0 -1
  224. data/lib/chef/resource/windows_update_settings.rb +0 -1
  225. data/lib/chef/resource/windows_user_privilege.rb +0 -1
  226. data/lib/chef/resource/windows_workgroup.rb +0 -1
  227. data/lib/chef/resource/yum_package.rb +0 -1
  228. data/lib/chef/resource/yum_repository.rb +0 -1
  229. data/lib/chef/resource/zypper_package.rb +0 -1
  230. data/lib/chef/resource/zypper_repository.rb +0 -1
  231. data/lib/chef/resource.rb +12 -5
  232. data/lib/chef/resources.rb +7 -0
  233. data/lib/chef/run_context.rb +3 -3
  234. data/lib/chef/secret_fetcher/azure_key_vault.rb +1 -1
  235. data/lib/chef/version.rb +1 -1
  236. data/lib/chef/win32/handle.rb +6 -7
  237. data/lib/chef/win32/registry.rb +7 -3
  238. data/spec/data/rubygems.org/sexp_processor-info +2 -1
  239. data/spec/data/trusted_certs/example.crt +20 -29
  240. data/spec/data/trusted_certs/example_no_cn.crt +34 -30
  241. data/spec/data/trusted_certs/opscode.pem +54 -33
  242. data/spec/functional/resource/chocolatey_package_spec.rb +20 -32
  243. data/spec/functional/resource/dsc_script_spec.rb +1 -1
  244. data/spec/functional/resource/group_spec.rb +26 -42
  245. data/spec/functional/resource/link_spec.rb +8 -8
  246. data/spec/functional/resource/macos_userdefaults_spec.rb +4 -4
  247. data/spec/functional/resource/plist_spec.rb +25 -0
  248. data/spec/functional/resource/user/linux_user_spec.rb +127 -0
  249. data/spec/functional/resource/windows_certificate_spec.rb +1 -26
  250. data/spec/functional/resource/windows_font_spec.rb +12 -9
  251. data/spec/functional/resource/yum_package_spec.rb +1 -17
  252. data/spec/functional/resource/zypper_package_spec.rb +12 -10
  253. data/spec/functional/shell_spec.rb +1 -2
  254. data/spec/functional/version_spec.rb +1 -1
  255. data/spec/functional/win32/registry_spec.rb +0 -3
  256. data/spec/integration/client/client_spec.rb +82 -3
  257. data/spec/integration/client/exit_code_spec.rb +1 -1
  258. data/spec/integration/client/ipv6_spec.rb +1 -1
  259. data/spec/integration/compliance/compliance_spec.rb +1 -1
  260. data/spec/integration/recipes/accumulator_spec.rb +1 -1
  261. data/spec/integration/recipes/lwrp_inline_resources_spec.rb +1 -1
  262. data/spec/integration/recipes/lwrp_spec.rb +1 -1
  263. data/spec/integration/recipes/notifies_spec.rb +1 -1
  264. data/spec/integration/recipes/notifying_block_spec.rb +1 -1
  265. data/spec/integration/recipes/remote_directory.rb +1 -1
  266. data/spec/integration/recipes/unified_mode_spec.rb +1 -1
  267. data/spec/integration/recipes/use_partial_spec.rb +2 -1
  268. data/spec/integration/solo/solo_spec.rb +2 -2
  269. data/spec/spec_helper.rb +1 -5
  270. data/spec/support/platform_helpers.rb +0 -4
  271. data/spec/support/ruby_installer.rb +1 -1
  272. data/spec/support/shared/functional/windows_script.rb +2 -2
  273. data/spec/unit/application/client_spec.rb +0 -10
  274. data/spec/unit/client_spec.rb +70 -2
  275. data/spec/unit/compliance/reporter/chef_server_automate_spec.rb +1 -1
  276. data/spec/unit/cookbook/syntax_check_spec.rb +3 -0
  277. data/spec/unit/http/authenticator_spec.rb +68 -0
  278. data/spec/unit/mixin/checksum_spec.rb +0 -28
  279. data/spec/unit/mixin/homebrew_user_spec.rb +7 -30
  280. data/spec/unit/mixin/openssl_helper_spec.rb +1 -1
  281. data/spec/unit/mixin/powershell_exec_spec.rb +5 -5
  282. data/spec/unit/platform/query_helpers_spec.rb +2 -17
  283. data/spec/unit/provider/cron_spec.rb +0 -34
  284. data/spec/unit/provider/http_request_spec.rb +60 -72
  285. data/spec/unit/provider/mount/linux_spec.rb +10 -0
  286. data/spec/unit/provider/package/chocolatey_spec.rb +3 -20
  287. data/spec/unit/provider/package/rubygems_spec.rb +1 -1
  288. data/spec/unit/provider/package/zypper_spec.rb +32 -0
  289. data/spec/unit/provider/user/linux_spec.rb +51 -11
  290. data/spec/unit/provider/user_spec.rb +24 -6
  291. data/spec/unit/resource/archive_file_spec.rb +1 -1
  292. data/spec/unit/resource/chef_client_cron_spec.rb +5 -0
  293. data/spec/unit/resource/chef_client_launchd_spec.rb +5 -0
  294. data/spec/unit/resource/chef_client_scheduled_task_spec.rb +5 -0
  295. data/spec/unit/resource/chef_client_systemd_timer_spec.rb +2 -2
  296. data/spec/unit/resource/cron_d_spec.rb +37 -1
  297. data/spec/unit/resource/macos_user_defaults_spec.rb +4 -4
  298. data/spec/unit/resource/rest_resource_spec.rb +381 -0
  299. data/spec/unit/resource/selinux_boolean_spec.rb +92 -0
  300. data/spec/unit/resource/selinux_fcontext_spec.rb +65 -0
  301. data/spec/unit/resource/selinux_install_spec.rb +60 -0
  302. data/spec/unit/resource/selinux_module_spec.rb +55 -0
  303. data/spec/unit/resource/selinux_permissive_spec.rb +39 -0
  304. data/spec/unit/resource/selinux_port_spec.rb +42 -0
  305. data/spec/unit/resource/selinux_state_spec.rb +46 -0
  306. data/spec/unit/resource/sysctl_spec.rb +2 -2
  307. data/spec/unit/resource/user/linux_user_spec.rb +42 -0
  308. data/spec/unit/resource_spec.rb +8 -2
  309. data/spec/unit/util/dsc/local_configuration_manager_spec.rb +1 -1
  310. data/tasks/rspec.rb +1 -1
  311. metadata +106 -55
  312. data/spec/functional/assets/yumrepo-empty/repodata/01a3b-filelists.sqlite.bz2 +0 -0
  313. data/spec/functional/assets/yumrepo-empty/repodata/401dc-filelists.xml.gz +0 -0
  314. data/spec/functional/assets/yumrepo-empty/repodata/5dc1e-primary.sqlite.bz2 +0 -0
  315. data/spec/functional/assets/yumrepo-empty/repodata/6bf96-other.xml.gz +0 -0
  316. data/spec/functional/assets/yumrepo-empty/repodata/7c365-other.sqlite.bz2 +0 -0
  317. data/spec/functional/assets/yumrepo-empty/repodata/dabe2-primary.xml.gz +0 -0
  318. data/spec/functional/assets/yumrepo-empty/repodata/repomd.xml +0 -55
  319. data/spec/integration/client/fips_spec.rb +0 -29
  320. data/spec/integration/client/open_ssl_spec.rb +0 -20
  321. /data/spec/functional/assets/chocolatey_feed/{test-A.1.0.0.nupkg → test-A.1.0.nupkg} +0 -0
  322. /data/spec/functional/assets/chocolatey_feed/{test-A.1.5.0.nupkg → test-A.1.5.nupkg} +0 -0
  323. /data/spec/functional/assets/chocolatey_feed/{test-A.2.0.0.nupkg → test-A.2.0.nupkg} +0 -0
  324. /data/spec/functional/assets/chocolatey_feed/{test-B.1.0.0.nupkg → test-B.1.0.nupkg} +0 -0
  325. /data/spec/functional/assets/yumrepo/repodata/{01a3b-filelists.sqlite.bz2 → 4632d67cb92636e7575d911c24f0e04d3505a944e97c483abe0c3e73a7c62d33-filelists.sqlite.bz2} +0 -0
  326. /data/spec/functional/assets/yumrepo/repodata/{6bf96-other.xml.gz → 74599b793e54d877323837d2d81a1c3c594c44e4335f9528234bb490f7b9b439-other.xml.gz} +0 -0
  327. /data/spec/functional/assets/yumrepo/repodata/{5dc1e-primary.sqlite.bz2 → a845d418f919d2115ab95a56b2c76f6825ad0d0bede49181a55c04f58995d057-primary.sqlite.bz2} +0 -0
  328. /data/spec/functional/assets/yumrepo/repodata/{7c365-other.sqlite.bz2 → af9b7cf9ef23bd7b43068d74a460f3b5d06753d638e58e4a0c9edc35bfb9cdc4-other.sqlite.bz2} +0 -0
  329. /data/spec/functional/assets/yumrepo/repodata/{401dc-filelists.xml.gz → bdb4f5f1492a3b9532f22c43110a81500dd744f23da0aec5c33b2a41317c737d-filelists.xml.gz} +0 -0
  330. /data/spec/functional/assets/yumrepo/repodata/{dabe2-primary.xml.gz → c10d1d34ce99e02f12ec96ef68360543ab1bb7c3cb81a4a2bf78df7d8597e9df-primary.xml.gz} +0 -0
@@ -21,7 +21,6 @@ require "chef-utils/dist" unless defined?(ChefUtils::Dist)
21
21
  class Chef
22
22
  class Resource
23
23
  class Locale < Chef::Resource
24
- unified_mode true
25
24
  provides :locale
26
25
 
27
26
  description "Use the **locale** resource to set the system's locale on Debian and Windows systems. Windows support was added in Chef Infra Client 16.0"
@@ -113,11 +112,8 @@ class Chef
113
112
  end
114
113
 
115
114
  requirements.assert(:all_actions) do |a|
116
- a.assertion do
117
- # RHEL/CentOS type platforms don't have locale-gen
118
- # Windows has locale-gen as part of the install, but not in the path
119
- which("locale-gen") || windows?
120
- end
115
+ # RHEL/CentOS type platforms don't have locale-gen
116
+ a.assertion { which("locale-gen") }
121
117
  a.failure_message(Chef::Exceptions::ProviderNotFound, "The locale resource requires the locale-gen tool")
122
118
  end
123
119
  end
@@ -29,7 +29,6 @@ class Chef
29
29
  # level :debug
30
30
  # end
31
31
  class Log < Chef::Resource
32
- unified_mode true
33
32
 
34
33
  provides :log, target_mode: true
35
34
 
@@ -54,10 +54,6 @@ class Chef
54
54
  resource_class.run_context = run_context
55
55
  resource_class.class_from_file(filename)
56
56
 
57
- if !resource_class.unified_mode && !deprecated_class(resource_class) && cookbook_name.to_s != "chef_client_updater"
58
- Chef.deprecated :unified_mode, "The #{resource_class.resource_name} resource in the #{cookbook_name} cookbook should declare `unified_mode true`", filename
59
- end
60
-
61
57
  # Make a useful string for the class (rather than <Class:312894723894>)
62
58
  resource_class.instance_eval do
63
59
  define_singleton_method(:to_s) do
@@ -23,7 +23,6 @@ autoload :Plist, "plist"
23
23
  class Chef
24
24
  class Resource
25
25
  class MacosUserDefaults < Chef::Resource
26
- unified_mode true
27
26
 
28
27
  # align with apple's marketing department
29
28
  provides(:macos_userdefaults) { true }
@@ -51,17 +50,15 @@ class Chef
51
50
  end
52
51
  ```
53
52
 
54
- **Setting a value for specific user and hosts**
53
+ **Specifying the type of a key to skip automatic type detection**
55
54
 
56
55
  ```ruby
57
- macos_userdefaults 'Enable macOS firewall' do
58
- key 'globalstate'
59
- value 1
60
- user 'jane'
61
- host :current
56
+ macos_userdefaults 'Finder expanded save dialogs' do
57
+ key 'NSNavPanelExpandedStateForSaveMode'
58
+ value 'TRUE'
59
+ type 'bool'
62
60
  end
63
61
  ```
64
-
65
62
  DOC
66
63
 
67
64
  property :domain, String,
@@ -82,7 +79,6 @@ class Chef
82
79
 
83
80
  property :host, [String, Symbol],
84
81
  description: "Set either :current, :all or a hostname to set the user default at the host level.",
85
- default: :all,
86
82
  desired_state: false,
87
83
  introduced: "16.3"
88
84
 
@@ -98,7 +94,6 @@ class Chef
98
94
 
99
95
  property :user, [String, Symbol],
100
96
  description: "The system user that the default will be applied to. Set :current for current user, :all for all users or pass a valid username",
101
- default: :current,
102
97
  desired_state: false
103
98
 
104
99
  property :sudo, [TrueClass, FalseClass],
@@ -21,7 +21,6 @@ require_relative "service"
21
21
  class Chef
22
22
  class Resource
23
23
  class MacosxService < Chef::Resource::Service
24
- unified_mode true
25
24
 
26
25
  provides :macosx_service
27
26
  provides :service, os: "darwin"
@@ -21,7 +21,6 @@ require_relative "package"
21
21
  class Chef
22
22
  class Resource
23
23
  class MacportsPackage < Chef::Resource::Package
24
- unified_mode true
25
24
  provides :macports_package
26
25
 
27
26
  description "Use the **macports_package** resource to manage packages for the macOS platform using the MacPorts package management system."
@@ -22,7 +22,6 @@ require_relative "../resource"
22
22
  class Chef
23
23
  class Resource
24
24
  class Mdadm < Chef::Resource
25
- unified_mode true
26
25
 
27
26
  provides :mdadm
28
27
 
@@ -23,7 +23,6 @@ class Chef
23
23
  class Resource
24
24
  class Mount < Chef::Resource
25
25
  description "Use the **mount** resource to manage a mounted file system."
26
- unified_mode true
27
26
 
28
27
  provides :mount
29
28
 
@@ -23,7 +23,6 @@ class Chef
23
23
  class Resource
24
24
  class MsuPackage < Chef::Resource::Package
25
25
  include Chef::Mixin::Uris
26
- unified_mode true
27
26
 
28
27
  provides :msu_package
29
28
 
@@ -21,8 +21,6 @@ class Chef
21
21
  class NotifyGroup < Chef::Resource
22
22
  provides :notify_group
23
23
 
24
- unified_mode true
25
-
26
24
  description "The notify_group resource does nothing, and always fires notifications which are set on it. Use it to DRY blocks of notifications that are common to multiple resources, and provide a single target for other resources to notify. Unlike most resources, its default action is :nothing."
27
25
  introduced "15.8"
28
26
  examples <<~DOC
@@ -25,7 +25,6 @@ require "ohai" unless defined?(Ohai::System)
25
25
  class Chef
26
26
  class Resource
27
27
  class Ohai < Chef::Resource
28
- unified_mode true
29
28
 
30
29
  provides :ohai
31
30
 
@@ -20,7 +20,6 @@ require_relative "../resource"
20
20
  class Chef
21
21
  class Resource
22
22
  class OhaiHint < Chef::Resource
23
- unified_mode true
24
23
 
25
24
  provides(:ohai_hint) { true }
26
25
 
@@ -25,7 +25,6 @@ require_relative "../provider/package/openbsd"
25
25
  class Chef
26
26
  class Resource
27
27
  class OpenbsdPackage < Chef::Resource::Package
28
- unified_mode true
29
28
  provides :openbsd_package
30
29
  provides :package, os: "openbsd"
31
30
 
@@ -23,8 +23,6 @@ class Chef
23
23
  require_relative "../mixin/openssl_helper"
24
24
  include Chef::Mixin::OpenSSLHelper
25
25
 
26
- unified_mode true
27
-
28
26
  provides(:openssl_dhparam) { true }
29
27
 
30
28
  description "Use the **openssl_dhparam** resource to generate `dhparam.pem` files. If a valid `dhparam.pem` file is found at the specified location, no new file will be created. If a file is found at the specified location but it is not a valid `dhparam.pem` file, it will be overwritten."
@@ -24,8 +24,6 @@ class Chef
24
24
  require_relative "../mixin/openssl_helper"
25
25
  include Chef::Mixin::OpenSSLHelper
26
26
 
27
- unified_mode true
28
-
29
27
  provides :openssl_ec_private_key
30
28
 
31
29
  description "Use the **openssl_ec_private_key** resource to generate an elliptic curve (EC) private key file. If a valid EC key file can be opened at the specified location, no new file will be created. If the EC key file cannot be opened, either because it does not exist or because the password to the EC key file does not match the password in the recipe, then it will be overwritten."
@@ -24,8 +24,6 @@ class Chef
24
24
  require_relative "../mixin/openssl_helper"
25
25
  include Chef::Mixin::OpenSSLHelper
26
26
 
27
- unified_mode true
28
-
29
27
  provides :openssl_ec_public_key
30
28
 
31
29
  description "Use the **openssl_ec_public_key** resource to generate elliptic curve (EC) public key files from a given EC private key."
@@ -23,8 +23,6 @@ class Chef
23
23
  require_relative "../mixin/openssl_helper"
24
24
  include Chef::Mixin::OpenSSLHelper
25
25
 
26
- unified_mode true
27
-
28
26
  provides(:openssl_rsa_private_key) { true }
29
27
  provides(:openssl_rsa_key) { true } # legacy cookbook resource name
30
28
 
@@ -23,8 +23,6 @@ class Chef
23
23
  require_relative "../mixin/openssl_helper"
24
24
  include Chef::Mixin::OpenSSLHelper
25
25
 
26
- unified_mode true
27
-
28
26
  provides(:openssl_rsa_public_key) { true }
29
27
 
30
28
  examples <<~DOC
@@ -24,8 +24,6 @@ class Chef
24
24
  require_relative "../mixin/openssl_helper"
25
25
  include Chef::Mixin::OpenSSLHelper
26
26
 
27
- unified_mode true
28
-
29
27
  provides :openssl_x509_certificate
30
28
  provides(:openssl_x509) { true } # legacy cookbook name.
31
29
 
@@ -24,8 +24,6 @@ class Chef
24
24
  require_relative "../mixin/openssl_helper"
25
25
  include Chef::Mixin::OpenSSLHelper
26
26
 
27
- unified_mode true
28
-
29
27
  provides :openssl_x509_crl
30
28
 
31
29
  description "Use the **openssl_x509_crl** resource to generate PEM-formatted x509 certificate revocation list (CRL) files."
@@ -24,8 +24,6 @@ class Chef
24
24
  require_relative "../mixin/openssl_helper"
25
25
  include Chef::Mixin::OpenSSLHelper
26
26
 
27
- unified_mode true
28
-
29
27
  provides :openssl_x509_request
30
28
 
31
29
  description "Use the **openssl_x509_request** resource to generate PEM-formatted x509 certificates requests. If no existing key is specified, the resource will automatically generate a passwordless key with the certificate."
@@ -25,7 +25,6 @@ autoload :Plist, "plist"
25
25
  class Chef
26
26
  class Resource
27
27
  class OsxProfile < Chef::Resource
28
- unified_mode true
29
28
 
30
29
  provides :osx_profile
31
30
  provides :osx_config_profile
@@ -22,7 +22,6 @@ require_relative "../resource"
22
22
  class Chef
23
23
  class Resource
24
24
  class Package < Chef::Resource
25
- unified_mode true
26
25
  provides :package
27
26
 
28
27
  description "Use the **package** resource to manage packages. When the package is"\
@@ -21,7 +21,6 @@ require_relative "package"
21
21
  class Chef
22
22
  class Resource
23
23
  class PacmanPackage < Chef::Resource::Package
24
- unified_mode true
25
24
 
26
25
  provides :pacman_package
27
26
 
@@ -22,7 +22,6 @@ require_relative "../provider/package/paludis"
22
22
  class Chef
23
23
  class Resource
24
24
  class PaludisPackage < Chef::Resource::Package
25
- unified_mode true
26
25
 
27
26
  provides :paludis_package
28
27
 
@@ -21,7 +21,6 @@ require_relative "script"
21
21
  class Chef
22
22
  class Resource
23
23
  class Perl < Chef::Resource::Script
24
- unified_mode true
25
24
 
26
25
  provides :perl
27
26
 
@@ -22,7 +22,6 @@ class Chef
22
22
  class Resource
23
23
 
24
24
  class PlistResource < Chef::Resource # we name this PlistResource to avoid confusion with Plist from the plist gem
25
- unified_mode true
26
25
 
27
26
  provides :plist
28
27
 
@@ -85,7 +84,7 @@ class Chef
85
84
  converge_if_changed :path do
86
85
  converge_by "create new plist: '#{new_resource.path}'" do
87
86
  file new_resource.path do
88
- content {}.to_plist
87
+ content({}.to_plist)
89
88
  owner new_resource.owner
90
89
  group new_resource.group
91
90
  mode new_resource.mode if property_is_set?(:mode)
@@ -189,7 +188,12 @@ class Chef
189
188
  sep = " "
190
189
  arg = case subcommand.to_s
191
190
  when "add"
192
- type_to_commandline_string(value)
191
+ if value.is_a?(Hash)
192
+ sep = ":"
193
+ value.map { |k, v| "#{k} #{type_to_commandline_string(v)}" }
194
+ else
195
+ type_to_commandline_string(value)
196
+ end
193
197
  when "set"
194
198
  if value.is_a?(Hash)
195
199
  sep = ":"
@@ -21,7 +21,6 @@ require_relative "package"
21
21
  class Chef
22
22
  class Resource
23
23
  class PortagePackage < Chef::Resource::Package
24
- unified_mode true
25
24
 
26
25
  provides :portage_package
27
26
 
@@ -20,7 +20,6 @@ require_relative "package"
20
20
  class Chef
21
21
  class Resource
22
22
  class PowershellPackage < Chef::Resource::Package
23
- unified_mode true
24
23
 
25
24
  provides :powershell_package
26
25
 
@@ -21,7 +21,6 @@ require_relative "../resource"
21
21
  class Chef
22
22
  class Resource
23
23
  class PowershellPackageSource < Chef::Resource
24
- unified_mode true
25
24
 
26
25
  provides :powershell_package_source
27
26
 
@@ -20,7 +20,6 @@ require_relative "windows_script"
20
20
  class Chef
21
21
  class Resource
22
22
  class PowershellScript < Chef::Resource::WindowsScript
23
- unified_mode true
24
23
 
25
24
  set_guard_inherited_attributes(:interpreter)
26
25
 
@@ -20,7 +20,6 @@ require_relative "script"
20
20
  class Chef
21
21
  class Resource
22
22
  class Python < Chef::Resource::Script
23
- unified_mode true
24
23
 
25
24
  provides :python
26
25
 
@@ -22,7 +22,6 @@ require "chef-utils/dist" unless defined?(ChefUtils::Dist)
22
22
  class Chef
23
23
  class Resource
24
24
  class Reboot < Chef::Resource
25
- unified_mode true
26
25
 
27
26
  provides :reboot
28
27
 
@@ -23,7 +23,6 @@ require "chef-utils/dist" unless defined?(ChefUtils::Dist)
23
23
  class Chef
24
24
  class Resource
25
25
  class RegistryKey < Chef::Resource
26
- unified_mode true
27
26
 
28
27
  provides(:registry_key) { true }
29
28
 
@@ -25,7 +25,6 @@ class Chef
25
25
  class Resource
26
26
  class RemoteDirectory < Chef::Resource::Directory
27
27
  include Chef::Mixin::Securable
28
- unified_mode true
29
28
 
30
29
  provides :remote_directory
31
30
 
@@ -28,7 +28,6 @@ class Chef
28
28
  class Resource
29
29
  class RemoteFile < Chef::Resource::File
30
30
  include Chef::Mixin::Securable
31
- unified_mode true
32
31
 
33
32
  provides :remote_file
34
33
 
@@ -20,7 +20,6 @@ require_relative "../resource"
20
20
  class Chef
21
21
  class Resource
22
22
  class RhsmErrata < Chef::Resource
23
- unified_mode true
24
23
  provides(:rhsm_errata) { true }
25
24
 
26
25
  description "Use the **rhsm_errata** resource to install packages associated with a given Red Hat Subscription Manager Errata ID. This is helpful if packages to mitigate a single vulnerability must be installed on your hosts."
@@ -20,7 +20,6 @@ require_relative "../resource"
20
20
  class Chef
21
21
  class Resource
22
22
  class RhsmErrataLevel < Chef::Resource
23
- unified_mode true
24
23
  provides(:rhsm_errata_level) { true }
25
24
 
26
25
  description "Use the **rhsm_errata_level** resource to install all packages of a specified errata level from the Red Hat Subscription Manager. For example, you can ensure that all packages associated with errata marked at a 'Critical' security level are installed."
@@ -22,7 +22,6 @@ require "shellwords" unless defined?(Shellwords)
22
22
  class Chef
23
23
  class Resource
24
24
  class RhsmRegister < Chef::Resource
25
- unified_mode true
26
25
  provides(:rhsm_register) { true }
27
26
 
28
27
  description "Use the **rhsm_register** resource to register a node with the Red Hat Subscription Manager or a local Red Hat Satellite server."
@@ -137,8 +136,6 @@ class Chef
137
136
  end
138
137
 
139
138
  action :unregister, description: "Unregister the node from RHSM." do
140
- description "Unregister the node from RHSM."
141
-
142
139
  package flush_package_cache_name do
143
140
  action :nothing
144
141
  end
@@ -20,7 +20,6 @@ require_relative "../resource"
20
20
  class Chef
21
21
  class Resource
22
22
  class RhsmRepo < Chef::Resource
23
- unified_mode true
24
23
 
25
24
  provides(:rhsm_repo) { true }
26
25
 
@@ -20,7 +20,6 @@ require_relative "../resource"
20
20
  class Chef
21
21
  class Resource
22
22
  class RhsmSubscription < Chef::Resource
23
- unified_mode true
24
23
 
25
24
  provides(:rhsm_subscription) { true }
26
25
 
@@ -22,7 +22,6 @@ require_relative "../resource"
22
22
  class Chef
23
23
  class Resource
24
24
  class Route < Chef::Resource
25
- unified_mode true
26
25
 
27
26
  provides :route
28
27
 
@@ -21,7 +21,6 @@ require_relative "package"
21
21
  class Chef
22
22
  class Resource
23
23
  class RpmPackage < Chef::Resource::Package
24
- unified_mode true
25
24
 
26
25
  provides :rpm_package
27
26
 
@@ -21,7 +21,6 @@ require_relative "script"
21
21
  class Chef
22
22
  class Resource
23
23
  class Ruby < Chef::Resource::Script
24
- unified_mode true
25
24
 
26
25
  provides :ruby
27
26
 
@@ -24,7 +24,6 @@ require "chef-utils/dist" unless defined?(ChefUtils::Dist)
24
24
  class Chef
25
25
  class Resource
26
26
  class RubyBlock < Chef::Resource
27
- unified_mode true
28
27
 
29
28
  provides :ruby_block, target_mode: true
30
29
 
@@ -16,8 +16,6 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- unified_mode true
20
-
21
19
  default_action :sync
22
20
  allowed_actions :checkout, :export, :sync, :diff, :log
23
21
 
@@ -23,8 +23,6 @@ class Chef
23
23
  class Git < Chef::Resource
24
24
  use "scm"
25
25
 
26
- unified_mode true
27
-
28
26
  provides :git
29
27
 
30
28
  description "Use the **git** resource to manage source control resources that exist in a git repository. git version 1.6.5 (or higher) is required to use all of the functionality in the git resource."
@@ -24,8 +24,6 @@ class Chef
24
24
  class Subversion < Chef::Resource
25
25
  use "scm"
26
26
 
27
- unified_mode true
28
-
29
27
  provides :subversion
30
28
 
31
29
  description "Use the **subversion** resource to manage source control resources that exist in a Subversion repository. Warning: The subversion resource has known bugs and may not work as expected. For more information see Chef GitHub issues, particularly [#4050](https://github.com/chef/chef/issues/4050) and [#4257](https://github.com/chef/chef/issues/4257)."
@@ -22,7 +22,6 @@ require_relative "execute"
22
22
  class Chef
23
23
  class Resource
24
24
  class Script < Chef::Resource::Execute
25
- unified_mode true
26
25
 
27
26
  provides :script
28
27
 
@@ -0,0 +1,47 @@
1
+ #
2
+ # Licensed under the Apache License, Version 2.0 (the "License");
3
+ # you may not use this file except in compliance with the License.
4
+ # You may obtain a copy of the License at
5
+ #
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software
9
+ # distributed under the License is distributed on an "AS IS" BASIS,
10
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ # See the License for the specific language governing permissions and
12
+ # limitations under the License.
13
+ #
14
+ class Chef
15
+ module SELinux
16
+ module CommonHelpers
17
+ def selinux_disabled?
18
+ selinux_state.eql?(:disabled)
19
+ end
20
+
21
+ def selinux_enforcing?
22
+ selinux_state.eql?(:enforcing)
23
+ end
24
+
25
+ def selinux_permissive?
26
+ selinux_state.eql?(:permissive)
27
+ end
28
+
29
+ def state_change_reboot_required?
30
+ (selinux_disabled? && %i{enforcing permissive}.include?(action)) || ((selinux_enforcing? || selinux_permissive?) && action == :disabled)
31
+ end
32
+
33
+ def selinux_state
34
+ state = shell_out!("getenforce").stdout.strip.downcase.to_sym
35
+ raise "Got unknown SELinux state #{state}" unless %i{disabled enforcing permissive}.include?(state)
36
+
37
+ state
38
+ end
39
+
40
+ def selinux_activate_required?
41
+ return false unless platform_family?("debian")
42
+
43
+ !File.read("/etc/default/grub").match?("security=selinux")
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,18 @@
1
+ # Generated by Chef for <%= node['fqdn'] %>
2
+ # Do NOT modify this file by hand.
3
+ #
4
+
5
+ # This file controls the state of SELinux on the system.
6
+ # SELINUX= can take one of these three values:
7
+ # enforcing - SELinux security policy is enforced.
8
+ # permissive - SELinux prints warnings instead of enforcing.
9
+ # disabled - No SELinux policy is loaded.
10
+ SELINUX=<%= @selinux %>
11
+ # SELINUXTYPE= can take one of these three values:
12
+ # default - equivalent to the old strict and targeted policies
13
+ # mls - Multi-Level Security (for military and educational use)
14
+ # src - Custom policy built from source
15
+ SELINUXTYPE=<%= @selinuxtype %>
16
+
17
+ # SETLOCALDEFS= Check local definition changes
18
+ SETLOCALDEFS=0
@@ -0,0 +1,15 @@
1
+ # Generated by Chef for <%= node['fqdn'] %>
2
+ # Do NOT modify this file by hand.
3
+ #
4
+
5
+ # This file controls the state of SELinux on the system.
6
+ # SELINUX= can take one of these three values:
7
+ # enforcing - SELinux security policy is enforced.
8
+ # permissive - SELinux prints warnings instead of enforcing.
9
+ # disabled - No SELinux policy is loaded.
10
+ SELINUX=<%= @selinux %>
11
+ # SELINUXTYPE= can take one of these three values:
12
+ # targeted - Targeted processes are protected,
13
+ # minimum - Modification of targeted policy. Only selected processes are protected.
14
+ # mls - Multi Level Security protection.
15
+ SELINUXTYPE=<%= @selinuxtype %>