chef 18.5.0 → 18.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +11 -6
  3. data/chef-universal-mingw-ucrt.gemspec +1 -1
  4. data/chef.gemspec +19 -15
  5. data/lib/chef/application/client.rb +0 -12
  6. data/lib/chef/client.rb +1 -10
  7. data/lib/chef/compliance/default_attributes.rb +2 -2
  8. data/lib/chef/compliance/runner.rb +6 -11
  9. data/lib/chef/cookbook/metadata.rb +1 -1
  10. data/lib/chef/cookbook/remote_file_vendor.rb +1 -3
  11. data/lib/chef/cookbook/synchronizer.rb +0 -5
  12. data/lib/chef/event_dispatch/dispatcher.rb +0 -1
  13. data/lib/chef/exceptions.rb +1 -1
  14. data/lib/chef/file_access_control/unix.rb +9 -9
  15. data/lib/chef/file_content_management/deploy.rb +1 -4
  16. data/lib/chef/mixin/file_class.rb +1 -3
  17. data/lib/chef/mixin/get_source_from_package.rb +1 -1
  18. data/lib/chef/mixin/{homebrew_user.rb → homebrew.rb} +13 -16
  19. data/lib/chef/mixin/openssl_helper.rb +1 -12
  20. data/lib/chef/provider/cookbook_file.rb +1 -1
  21. data/lib/chef/provider/cron.rb +1 -1
  22. data/lib/chef/provider/directory.rb +15 -15
  23. data/lib/chef/provider/file.rb +29 -42
  24. data/lib/chef/provider/git.rb +8 -8
  25. data/lib/chef/provider/group/aix.rb +1 -1
  26. data/lib/chef/provider/group/dscl.rb +1 -1
  27. data/lib/chef/provider/group/gpasswd.rb +2 -2
  28. data/lib/chef/provider/group/groupadd.rb +1 -1
  29. data/lib/chef/provider/group/groupmod.rb +2 -2
  30. data/lib/chef/provider/group/pw.rb +2 -2
  31. data/lib/chef/provider/group/solaris.rb +2 -2
  32. data/lib/chef/provider/group/usermod.rb +2 -2
  33. data/lib/chef/provider/group.rb +1 -1
  34. data/lib/chef/provider/http_request.rb +3 -2
  35. data/lib/chef/provider/ifconfig/aix.rb +1 -1
  36. data/lib/chef/provider/ifconfig/debian.rb +3 -3
  37. data/lib/chef/provider/ifconfig/redhat.rb +1 -1
  38. data/lib/chef/provider/ifconfig.rb +1 -1
  39. data/lib/chef/provider/link.rb +10 -10
  40. data/lib/chef/provider/mount/aix.rb +4 -4
  41. data/lib/chef/provider/mount/linux.rb +4 -4
  42. data/lib/chef/provider/mount/mount.rb +11 -11
  43. data/lib/chef/provider/package/apt.rb +11 -2
  44. data/lib/chef/provider/package/bff.rb +3 -3
  45. data/lib/chef/provider/package/chocolatey.rb +2 -2
  46. data/lib/chef/provider/package/dnf/dnf_helper.py +7 -0
  47. data/lib/chef/provider/package/dpkg.rb +3 -3
  48. data/lib/chef/provider/package/freebsd/base.rb +1 -1
  49. data/lib/chef/provider/package/habitat.rb +3 -5
  50. data/lib/chef/provider/package/homebrew.rb +6 -9
  51. data/lib/chef/provider/package/ips.rb +2 -2
  52. data/lib/chef/provider/package/openbsd.rb +2 -3
  53. data/lib/chef/provider/package/pacman.rb +4 -4
  54. data/lib/chef/provider/package/paludis.rb +2 -2
  55. data/lib/chef/provider/package/portage.rb +1 -1
  56. data/lib/chef/provider/package/rpm.rb +2 -2
  57. data/lib/chef/provider/package/rubygems.rb +4 -0
  58. data/lib/chef/provider/package/smartos.rb +2 -2
  59. data/lib/chef/provider/package/snap.rb +2 -2
  60. data/lib/chef/provider/package/solaris.rb +4 -4
  61. data/lib/chef/provider/package/zypper.rb +4 -4
  62. data/lib/chef/provider/package.rb +1 -1
  63. data/lib/chef/provider/registry_key.rb +6 -0
  64. data/lib/chef/provider/remote_directory.rb +5 -5
  65. data/lib/chef/provider/remote_file/http.rb +3 -2
  66. data/lib/chef/provider/remote_file.rb +1 -1
  67. data/lib/chef/provider/route.rb +9 -9
  68. data/lib/chef/provider/service/aix.rb +1 -1
  69. data/lib/chef/provider/service/aixinit.rb +4 -4
  70. data/lib/chef/provider/service/arch.rb +6 -6
  71. data/lib/chef/provider/service/debian.rb +5 -5
  72. data/lib/chef/provider/service/freebsd.rb +7 -7
  73. data/lib/chef/provider/service/gentoo.rb +5 -5
  74. data/lib/chef/provider/service/init.rb +2 -2
  75. data/lib/chef/provider/service/insserv.rb +2 -2
  76. data/lib/chef/provider/service/invokercd.rb +1 -1
  77. data/lib/chef/provider/service/openbsd.rb +7 -7
  78. data/lib/chef/provider/service/redhat.rb +3 -3
  79. data/lib/chef/provider/service/solaris.rb +2 -2
  80. data/lib/chef/provider/service/systemd.rb +2 -2
  81. data/lib/chef/provider/service/upstart.rb +2 -2
  82. data/lib/chef/provider/subversion.rb +8 -8
  83. data/lib/chef/provider/systemd_unit.rb +3 -3
  84. data/lib/chef/provider/template.rb +1 -1
  85. data/lib/chef/provider/user/aix.rb +3 -3
  86. data/lib/chef/provider/user/linux.rb +2 -7
  87. data/lib/chef/provider/user/pw.rb +3 -3
  88. data/lib/chef/provider/user/solaris.rb +7 -7
  89. data/lib/chef/provider/user/windows.rb +5 -0
  90. data/lib/chef/provider/user.rb +8 -7
  91. data/lib/chef/provider/yum_repository.rb +3 -1
  92. data/lib/chef/provider/zypper_repository.rb +1 -1
  93. data/lib/chef/providers.rb +0 -1
  94. data/lib/chef/resource/alternatives.rb +2 -2
  95. data/lib/chef/resource/apt_preference.rb +1 -1
  96. data/lib/chef/resource/apt_repository.rb +90 -15
  97. data/lib/chef/resource/apt_update.rb +3 -3
  98. data/lib/chef/resource/bff_package.rb +1 -1
  99. data/lib/chef/resource/chef_client_config.rb +3 -2
  100. data/lib/chef/resource/chef_sleep.rb +1 -1
  101. data/lib/chef/resource/cookbook_file.rb +1 -1
  102. data/lib/chef/resource/cron/cron.rb +1 -1
  103. data/lib/chef/resource/cron/cron_d.rb +1 -1
  104. data/lib/chef/resource/cron_access.rb +1 -1
  105. data/lib/chef/resource/directory.rb +1 -1
  106. data/lib/chef/resource/dpkg_package.rb +1 -1
  107. data/lib/chef/resource/file/verification/json.rb +1 -1
  108. data/lib/chef/resource/file/verification/systemd_unit.rb +1 -1
  109. data/lib/chef/resource/file/verification/yaml.rb +1 -1
  110. data/lib/chef/resource/file.rb +1 -1
  111. data/lib/chef/resource/freebsd_package.rb +2 -2
  112. data/lib/chef/resource/group.rb +1 -1
  113. data/lib/chef/resource/habitat/habitat_package.rb +1 -1
  114. data/lib/chef/resource/habitat/habitat_sup.rb +9 -9
  115. data/lib/chef/resource/habitat/habitat_sup_systemd.rb +2 -2
  116. data/lib/chef/resource/habitat_install.rb +3 -3
  117. data/lib/chef/resource/homebrew_cask.rb +19 -30
  118. data/lib/chef/resource/homebrew_tap.rb +32 -17
  119. data/lib/chef/resource/homebrew_update.rb +4 -4
  120. data/lib/chef/resource/hostname.rb +10 -11
  121. data/lib/chef/resource/http_request.rb +1 -1
  122. data/lib/chef/resource/ifconfig.rb +1 -1
  123. data/lib/chef/resource/inspec_input.rb +1 -3
  124. data/lib/chef/resource/inspec_waiver.rb +1 -1
  125. data/lib/chef/resource/inspec_waiver_file_entry.rb +1 -1
  126. data/lib/chef/resource/ips_package.rb +2 -2
  127. data/lib/chef/resource/kernel_module.rb +2 -2
  128. data/lib/chef/resource/link.rb +1 -1
  129. data/lib/chef/resource/locale.rb +2 -2
  130. data/lib/chef/resource/mount.rb +1 -1
  131. data/lib/chef/resource/notify_group.rb +1 -1
  132. data/lib/chef/resource/ohai.rb +1 -1
  133. data/lib/chef/resource/ohai_hint.rb +1 -1
  134. data/lib/chef/resource/openbsd_package.rb +2 -2
  135. data/lib/chef/resource/package.rb +1 -1
  136. data/lib/chef/resource/pacman_package.rb +1 -1
  137. data/lib/chef/resource/paludis_package.rb +1 -1
  138. data/lib/chef/resource/portage_package.rb +1 -1
  139. data/lib/chef/resource/reboot.rb +1 -1
  140. data/lib/chef/resource/registry_key.rb +18 -0
  141. data/lib/chef/resource/remote_directory.rb +1 -1
  142. data/lib/chef/resource/remote_file.rb +1 -1
  143. data/lib/chef/resource/rhsm_errata.rb +1 -1
  144. data/lib/chef/resource/rhsm_errata_level.rb +1 -1
  145. data/lib/chef/resource/rhsm_register.rb +1 -1
  146. data/lib/chef/resource/rhsm_repo.rb +4 -3
  147. data/lib/chef/resource/rhsm_subscription.rb +9 -8
  148. data/lib/chef/resource/route.rb +1 -1
  149. data/lib/chef/resource/rpm_package.rb +1 -1
  150. data/lib/chef/resource/scm/git.rb +1 -1
  151. data/lib/chef/resource/scm/subversion.rb +1 -1
  152. data/lib/chef/resource/selinux/common_helpers.rb +1 -1
  153. data/lib/chef/resource/selinux_boolean.rb +1 -1
  154. data/lib/chef/resource/selinux_fcontext.rb +3 -3
  155. data/lib/chef/resource/selinux_install.rb +1 -1
  156. data/lib/chef/resource/selinux_login.rb +1 -1
  157. data/lib/chef/resource/selinux_module.rb +5 -5
  158. data/lib/chef/resource/selinux_permissive.rb +2 -2
  159. data/lib/chef/resource/selinux_port.rb +2 -2
  160. data/lib/chef/resource/selinux_state.rb +2 -2
  161. data/lib/chef/resource/selinux_user.rb +1 -1
  162. data/lib/chef/resource/smartos_package.rb +2 -2
  163. data/lib/chef/resource/snap_package.rb +1 -1
  164. data/lib/chef/resource/solaris_package.rb +1 -1
  165. data/lib/chef/resource/ssh_known_hosts_entry.rb +1 -1
  166. data/lib/chef/resource/sudo.rb +5 -5
  167. data/lib/chef/resource/support/client.erb +3 -2
  168. data/lib/chef/resource/swap_file.rb +6 -6
  169. data/lib/chef/resource/sysctl.rb +5 -5
  170. data/lib/chef/resource/systemd_unit.rb +1 -1
  171. data/lib/chef/resource/template.rb +1 -1
  172. data/lib/chef/resource/timezone.rb +5 -5
  173. data/lib/chef/resource/user/aix_user.rb +2 -2
  174. data/lib/chef/resource/user/linux_user.rb +2 -2
  175. data/lib/chef/resource/user/pw_user.rb +2 -2
  176. data/lib/chef/resource/user/solaris_user.rb +2 -2
  177. data/lib/chef/resource/user_ulimit.rb +1 -1
  178. data/lib/chef/resource/yum_repository.rb +1 -1
  179. data/lib/chef/resource/zypper_package.rb +2 -2
  180. data/lib/chef/resource/zypper_repository.rb +2 -2
  181. data/lib/chef/resource.rb +1 -0
  182. data/lib/chef/resource_inspector.rb +25 -7
  183. data/lib/chef/resource_reporter.rb +1 -0
  184. data/lib/chef/run_lock.rb +0 -3
  185. data/lib/chef/scan_access_control.rb +6 -6
  186. data/lib/chef/util/backup.rb +1 -1
  187. data/lib/chef/util/diff.rb +1 -14
  188. data/lib/chef/util/file_edit.rb +4 -4
  189. data/lib/chef/util/powershell/ps_credential.rb +10 -0
  190. data/lib/chef/version.rb +1 -1
  191. data/lib/chef/win32/registry.rb +5 -1
  192. data/lib/chef/win32/security.rb +9 -0
  193. data/lib/chef.rb +0 -2
  194. data/spec/functional/assets/yumrepo-empty/repodata/repomd.xml +6 -6
  195. data/spec/functional/resource/cookbook_file_spec.rb +1 -1
  196. data/spec/functional/resource/registry_spec.rb +276 -609
  197. data/spec/integration/client/open_ssl_spec.rb +1 -1
  198. data/spec/spec_helper.rb +1 -0
  199. data/spec/support/chef_helpers.rb +2 -2
  200. data/spec/support/platform_helpers.rb +8 -0
  201. data/spec/support/shared/functional/file_resource.rb +3 -3
  202. data/spec/tiny_server.rb +5 -2
  203. data/spec/unit/mixin/homebrew_spec.rb +118 -0
  204. data/spec/unit/provider/apt_repository_spec.rb +14 -9
  205. data/spec/unit/provider/package/chocolatey_spec.rb +1 -1
  206. data/spec/unit/provider/package/homebrew_spec.rb +4 -1
  207. data/spec/unit/provider/registry_key_spec.rb +18 -17
  208. data/spec/unit/provider/route_spec.rb +4 -6
  209. data/spec/unit/provider/user/windows_spec.rb +1 -0
  210. data/spec/unit/resource/rhsm_repo_spec.rb +0 -1
  211. data/spec/unit/resource/rhsm_subscription_spec.rb +0 -2
  212. data/spec/unit/resource_inspector_spec.rb +36 -0
  213. data/spec/unit/util/powershell/ps_credential_spec.rb +6 -0
  214. metadata +36 -44
  215. data/lib/chef/file_content_management/deploy/target_io.rb +0 -29
  216. data/lib/chef/provider/.gitkeep +0 -0
  217. data/lib/chef/provider/package/snap_tm.rb +0 -79
  218. data/lib/chef/resource/.gitkeep +0 -0
  219. data/lib/chef/target_io/dir.rb +0 -12
  220. data/lib/chef/target_io/etc.rb +0 -16
  221. data/lib/chef/target_io/file.rb +0 -12
  222. data/lib/chef/target_io/fileutils.rb +0 -12
  223. data/lib/chef/target_io/http.rb +0 -22
  224. data/lib/chef/target_io/io.rb +0 -12
  225. data/lib/chef/target_io/shadow.rb +0 -44
  226. data/lib/chef/target_io/train/dir.rb +0 -69
  227. data/lib/chef/target_io/train/etc.rb +0 -112
  228. data/lib/chef/target_io/train/file.rb +0 -219
  229. data/lib/chef/target_io/train/fileutils.rb +0 -220
  230. data/lib/chef/target_io/train/http.rb +0 -117
  231. data/lib/chef/target_io/train/io.rb +0 -13
  232. data/lib/chef/target_io/train/shadow.rb +0 -52
  233. data/lib/chef/target_io/train_compat.rb +0 -7
  234. data/lib/chef/target_io.rb +0 -9
  235. data/spec/unit/mixin/homebrew_user_spec.rb +0 -119
  236. /data/spec/functional/assets/yumrepo-empty/repodata/{01a3b489a465bcac22a43492163df43451dc6ce47d27f66de289756b91635523-filelists.sqlite.bz2 → 01a3b-filelists.sqlite.bz2} +0 -0
  237. /data/spec/functional/assets/yumrepo-empty/repodata/{401dc19bda88c82c403423fb835844d64345f7e95f5b9835888189c03834cc93-filelists.xml.gz → 401dc-filelists.xml.gz} +0 -0
  238. /data/spec/functional/assets/yumrepo-empty/repodata/{5dc1e6e73c84803f059bb3065e684e56adfc289a7e398946574d79dac6643945-primary.sqlite.bz2 → 5dc1e-primary.sqlite.bz2} +0 -0
  239. /data/spec/functional/assets/yumrepo-empty/repodata/{6bf9672d0862e8ef8b8ff05a2fd0208a922b1f5978e6589d87944c88259cb670-other.xml.gz → 6bf96-other.xml.gz} +0 -0
  240. /data/spec/functional/assets/yumrepo-empty/repodata/{7c36572015e075add2b38b900837bcdbb8a504130ddff49b2351a7fc0affa3d4-other.sqlite.bz2 → 7c365-other.sqlite.bz2} +0 -0
  241. /data/spec/functional/assets/yumrepo-empty/repodata/{dabe2ce5481d23de1f4f52bdcfee0f9af98316c9e0de2ce8123adeefa0dd08b9-primary.xml.gz → dabe2-primary.xml.gz} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6aeb4e21d11cdf70486e7d5c78992d1248331091782075950ed11103f16313eb
4
- data.tar.gz: 0d0732e253f1ff220fa4460a98befd22879d206f09e3053527b0996c0a84c268
3
+ metadata.gz: cd6c311d620e980620e3c1933de98f896da522386e84cee0c0fa92ea8615c3b3
4
+ data.tar.gz: 8799e439771a8061aa5fada7f5b94c76001e4cab27ebf081741664db1b0dbeb4
5
5
  SHA512:
6
- metadata.gz: '067286ca73d5381ce8ffca9e20694d03b8b5032769ebec6805fdf51c03aadf5d7f2c55c6b1b27d32b81085b378b4e917410fa6dffb9532cae2130f3c6da8160f'
7
- data.tar.gz: 1e35e9df95757159af9ab8a22b1d59cbbf8c0e916fdc8ec032c8383921e7de9a9a05d5f6aaba138b3d53af9e4e8359c39bba0f64fb42e90201c704e8ce3bcfe4
6
+ metadata.gz: 224fe24ecc76d00d1bded47e7007225cc21479080582e25c6d792aa6d12b988a86d5205de3a3be29eb362f7880cdc884f6c746aee037ce0afec10402b49297d0
7
+ data.tar.gz: 16ef3b5a6b8c9c0ecb206d41b8353c63e2e1cf94240cfae67290f964d6bbd5f0b3578bb11322fdc617e28e502b1106cf9438ca897f8eecfbd0788153cb893af4
data/Gemfile CHANGED
@@ -2,16 +2,19 @@ source "https://rubygems.org"
2
2
 
3
3
  gem "chef", path: "."
4
4
 
5
- gem "ohai", git: "https://github.com/chef/ohai.git", branch: "main"
5
+ gem "ohai", git: "https://github.com/chef/ohai.git", branch: "18-stable"
6
6
 
7
7
  # Nwed to file a bug with rest-client. In the meantime, we can use this until they accept the update.
8
8
  gem "rest-client", git: "https://github.com/chef/rest-client", branch: "jfm/ucrt_update1"
9
9
 
10
- gem "ffi", ">= 1.15.5"
10
+ gem "ffi", ">= 1.15.5", "<= 1.17.0"
11
11
  gem "chef-utils", path: File.expand_path("chef-utils", __dir__) if File.exist?(File.expand_path("chef-utils", __dir__))
12
12
  gem "chef-config", path: File.expand_path("chef-config", __dir__) if File.exist?(File.expand_path("chef-config", __dir__))
13
+
13
14
  # required for FIPS or bundler will pick up default openssl
14
- gem "openssl", "= 3.2.0" unless Gem.platforms.any? { |platform| !platform.is_a?(String) && platform.os == "darwin" }
15
+ install_if -> { RUBY_PLATFORM !~ /darwin/ } do
16
+ gem "openssl", "= 3.2.0"
17
+ end
15
18
 
16
19
  if File.exist?(File.expand_path("chef-bin", __dir__))
17
20
  # bundling in a git checkout
@@ -41,8 +44,10 @@ end
41
44
 
42
45
  # Everything except AIX and Windows
43
46
  group(:ruby_shadow) do
44
- # if ruby-shadow does a release that supports ruby-3.0 this can be removed
45
- gem "ruby-shadow", git: "https://github.com/chef/ruby-shadow", branch: "lcg/ruby-3.0", platforms: :ruby unless RUBY_PLATFORM == "x64-mingw-ucrt"
47
+ install_if -> { !RUBY_PLATFORM.match?(/mingw/) } do
48
+ # if ruby-shadow does a release that supports ruby-3.0 this can be removed
49
+ gem "ruby-shadow", git: "https://github.com/chef/ruby-shadow", branch: "lcg/ruby-3.0", platforms: :ruby
50
+ end
46
51
  end
47
52
 
48
53
  # deps that cannot be put in the knife gem because they require a compiler and fail on windows nodes
@@ -51,7 +56,7 @@ group(:knife_windows_deps) do
51
56
  end
52
57
 
53
58
  group(:development, :test) do
54
- gem "rake"
59
+ gem "rake", ">= 12.3.3"
55
60
  gem "rspec"
56
61
  gem "webmock"
57
62
  gem "crack", "< 0.4.6" # due to https://github.com/jnunemaker/crack/pull/75
@@ -1,6 +1,6 @@
1
1
  gemspec = instance_eval(File.read(File.expand_path("chef.gemspec", __dir__)))
2
2
 
3
- gemspec.platform = Gem::Platform.new(%w{x64-mingw-ucrt})
3
+ gemspec.platform = Gem::Platform.new(%w{universal mingw-ucrt})
4
4
 
5
5
  gemspec.add_dependency "win32-api", "~> 1.10.0"
6
6
  gemspec.add_dependency "win32-event", "~> 0.6.1"
data/chef.gemspec CHANGED
@@ -1,10 +1,13 @@
1
- $:.unshift(File.dirname(__FILE__) + "/lib")
1
+ # on Windows, the directory location starts with "(eval at " because it's
2
+ # being evaled in
3
+ file_directory = File.dirname(__FILE__).gsub(/\(eval at /, "")
4
+ $:.unshift(File.join(file_directory, "lib"))
2
5
  vs_path = File.expand_path("chef-utils/lib/chef-utils/version_string.rb", __dir__)
3
6
 
4
7
  if File.exist?(vs_path)
5
8
  # include chef-utils/lib in the path if we're inside of chef vs. chef-utils gem
6
9
  # but add it to the end of the search path
7
- $: << (File.dirname(__FILE__) + "/chef-utils/lib")
10
+ $: << File.join(file_directory, "chef-utils", "lib")
8
11
  end
9
12
  # if the path doesn't exist then we're just in the wild gem and not in the git repo
10
13
  require "chef-utils/version_string"
@@ -14,7 +17,7 @@ Gem::Specification.new do |s|
14
17
  s.name = "chef"
15
18
  s.version = Chef::VERSION
16
19
  s.platform = Gem::Platform::RUBY
17
- s.extra_rdoc_files = ["README.md", "LICENSE" ]
20
+ s.extra_rdoc_files = ["README.md", "LICENSE"]
18
21
  s.summary = "A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure."
19
22
  s.description = s.summary
20
23
  s.license = "Apache-2.0"
@@ -30,27 +33,27 @@ Gem::Specification.new do |s|
30
33
 
31
34
  s.add_dependency "chef-config", "= #{Chef::VERSION}"
32
35
  s.add_dependency "chef-utils", "= #{Chef::VERSION}"
33
- s.add_dependency "train-core", "~> 3.10" # 3.2.28 fixes sudo prompts. See https://github.com/chef/chef/pull/9635
34
- s.add_dependency "train-winrm", ">= 0.2.5"
36
+ s.add_dependency "train-core", "~> 3.10", "<= 3.12.7"
37
+ s.add_dependency "train-winrm", "~> 0.2.17"
35
38
  s.add_dependency "train-rest", ">= 0.4.1" # target mode with rest APIs
36
39
 
37
40
  s.add_dependency "license-acceptance", ">= 1.0.5", "< 3"
38
41
  s.add_dependency "mixlib-cli", ">= 2.1.1", "< 3.0"
39
- s.add_dependency "mixlib-log", ">= 2.0.3", "< 4.0"
42
+ s.add_dependency "mixlib-log", ">= 2.0.3", "<= 3.1.1"
40
43
  s.add_dependency "mixlib-authentication", ">= 2.1", "< 4"
41
44
  s.add_dependency "mixlib-shellout", ">= 3.1.1", "< 4.0"
42
45
  s.add_dependency "mixlib-archive", ">= 0.4", "< 2.0"
43
46
  s.add_dependency "ohai", "~> 18.0"
44
47
  s.add_dependency "inspec-core", ">= 5", "< 6"
45
48
 
46
- s.add_dependency "ffi", ">= 1.15.5"
49
+ s.add_dependency "ffi", ">= 1.15.5", "<= 1.16.3"
47
50
  s.add_dependency "ffi-yajl", "~> 2.2"
48
51
  s.add_dependency "net-sftp", ">= 2.1.2", "< 5.0" # remote_file resource
49
52
  s.add_dependency "net-ftp" # remote_file resource
50
53
  s.add_dependency "erubis", "~> 2.7" # template resource / cookbook syntax check
51
54
  s.add_dependency "diff-lcs", ">= 1.2.4", "!= 1.4.0", "< 1.6.0" # 1.4 breaks output. Used in lib/chef/util/diff
52
55
  s.add_dependency "ffi-libarchive", "~> 1.0", ">= 1.0.3" # archive_file resource
53
- s.add_dependency "chef-zero", ">= 14.0.11"
56
+ s.add_dependency "chef-zero", ">= 15.0.17"
54
57
  s.add_dependency "chef-vault" # chef-vault resources and helpers
55
58
 
56
59
  s.add_dependency "plist", "~> 3.2" # launchd, dscl/mac user, macos_userdefaults, osx_profile and plist resources
@@ -66,8 +69,9 @@ Gem::Specification.new do |s|
66
69
  s.add_dependency "aws-sdk-s3", "~> 1.91" # s3 recipe-url support
67
70
  s.add_dependency "aws-sdk-secretsmanager", "~> 1.46"
68
71
  s.add_dependency "vault", "~> 0.18.2" # hashi vault official client gem
69
- s.bindir = "bin"
70
- s.executables = %w{ }
72
+
73
+ s.bindir = "bin"
74
+ s.executables = %w{ }
71
75
 
72
76
  s.require_paths = %w{ lib }
73
77
  s.files = %w{Gemfile Rakefile LICENSE README.md} +
@@ -76,11 +80,11 @@ Gem::Specification.new do |s|
76
80
  Dir.glob("tasks/rspec.rb")
77
81
 
78
82
  s.metadata = {
79
- "bug_tracker_uri" => "https://github.com/chef/chef/issues",
80
- "changelog_uri" => "https://github.com/chef/chef/blob/main/CHANGELOG.md",
83
+ "bug_tracker_uri" => "https://github.com/chef/chef/issues",
84
+ "changelog_uri" => "https://github.com/chef/chef/blob/main/CHANGELOG.md",
81
85
  "documentation_uri" => "https://docs.chef.io/",
82
- "homepage_uri" => "https://www.chef.io",
83
- "mailing_list_uri" => "https://discourse.chef.io/",
84
- "source_code_uri" => "https://github.com/chef/chef/",
86
+ "homepage_uri" => "https://www.chef.io",
87
+ "mailing_list_uri" => "https://discourse.chef.io/",
88
+ "source_code_uri" => "https://github.com/chef/chef/",
85
89
  }
86
90
  end
@@ -40,10 +40,6 @@ class Chef::Application::Client < Chef::Application::Base
40
40
  long: "--config CONFIG",
41
41
  description: "The configuration file to use."
42
42
 
43
- option :credentials,
44
- long: "--credentials CREDENTIALS",
45
- description: "Credentials file to use. Default: ~/.chef/credentials"
46
-
47
43
  unless ChefUtils.windows?
48
44
  option :daemonize,
49
45
  short: "-d [WAIT]",
@@ -129,14 +125,6 @@ class Chef::Application::Client < Chef::Application::Base
129
125
  Chef::Config.node_name = Chef::Config.target_mode.host unless Chef::Config.node_name
130
126
  end
131
127
 
132
- if config[:credentials]
133
- unless File.exist?(config[:credentials])
134
- Chef::Application.fatal!("credentials file #{config[:credentials]} not found")
135
- end
136
-
137
- Chef::Config.credentials = config[:credentials]
138
- end
139
-
140
128
  if Chef::Config[:daemonize]
141
129
  Chef::Config[:interval] ||= 1800
142
130
  end
data/lib/chef/client.rb CHANGED
@@ -292,7 +292,6 @@ class Chef
292
292
  Chef.provider_handler_map.lock!
293
293
 
294
294
  setup_run_context
295
- setup_targetmode if Chef::Config.target_mode?
296
295
 
297
296
  load_required_recipe(@rest, run_context) unless Chef::Config[:solo_legacy_mode]
298
297
 
@@ -572,15 +571,6 @@ class Chef
572
571
  end
573
572
  end
574
573
 
575
- #
576
- # Setup conditions for Target Mode.
577
- #
578
- # @api private
579
- #
580
- def setup_targetmode
581
- TargetIO::FileUtils.mkdir_p(Chef::Config[:file_cache_path])
582
- end
583
-
584
574
  #
585
575
  # Run ohai plugins. Runs all ohai plugins unless minimal_ohai is specified.
586
576
  #
@@ -1100,3 +1090,4 @@ end
1100
1090
  require_relative "cookbook_loader"
1101
1091
  require_relative "cookbook_version"
1102
1092
  require_relative "cookbook/synchronizer"
1093
+
@@ -38,8 +38,8 @@ class Chef
38
38
  # Allow for connections to HTTPS endpoints using self-signed ssl certificates.
39
39
  "insecure" => nil,
40
40
 
41
- # Controls verbosity of Chef InSpec runner. See less output when true.
42
- "quiet" => true,
41
+ # When set to true, it will suppress CLI output for compliance phase.
42
+ "quiet" => false,
43
43
 
44
44
  # Chef Inspec Compliance profiles to be used for scan of node.
45
45
  # See Compliance Phase documentation for further details:
@@ -208,16 +208,6 @@ class Chef
208
208
  logger.debug "Options are set to: #{opts}"
209
209
  runner = ::Inspec::Runner.new(opts)
210
210
 
211
- # Switch from local to remote backend for Target Mode
212
- if ChefConfig::Config.target_mode?
213
- logger.info "Configure InSpec backend to use established connection"
214
-
215
- connection = Chef.run_context.transport_connection
216
- backend = Inspec::Backend.new(connection)
217
-
218
- runner.set_backend(backend)
219
- end
220
-
221
211
  if profiles.empty?
222
212
  failed_report("No #{Inspec::Dist::PRODUCT_NAME} profiles are defined.")
223
213
  return
@@ -378,7 +368,12 @@ class Chef
378
368
  end
379
369
 
380
370
  def requested_reporters
381
- (Array(node["audit"]["reporter"]) + ["cli"]).uniq
371
+ if node["audit"]["quiet"]
372
+ logger.info "node[\"audit\"][\"quiet\"] is set to true, skipping cli reporter"
373
+ Array(node["audit"]["reporter"]).uniq - ["cli"]
374
+ else
375
+ (Array(node["audit"]["reporter"]) + ["cli"]).uniq
376
+ end
382
377
  end
383
378
 
384
379
  def create_timestamp_file
@@ -391,7 +391,7 @@ class Chef
391
391
  def recipes_from_cookbook_version(cookbook)
392
392
  cookbook.fully_qualified_recipe_names.map do |recipe_name|
393
393
  unqualified_name =
394
- if /::default$/.match?(recipe_name)
394
+ if recipe_name.end_with?("::default")
395
395
  name.to_s
396
396
  else
397
397
  recipe_name
@@ -43,9 +43,7 @@ class Chef
43
43
  raise "get_filename: Cannot determine segment/filename for incoming filename #{filename}"
44
44
  end
45
45
 
46
- raise "No such segment #{segment} in cookbook #{@cookbook_name}" unless @manifest.files_for(segment)
47
-
48
- found_manifest_record = @manifest.files_for(segment).find { |manifest_record| manifest_record[:path] == filename }
46
+ found_manifest_record = @manifest.manifest_records_by_path[filename]
49
47
  raise "No such file #{filename} in #{@cookbook_name}" unless found_manifest_record
50
48
 
51
49
  cache_filename = File.join("cookbooks", @cookbook_name, found_manifest_record["path"])
@@ -61,11 +61,6 @@ class Chef
61
61
 
62
62
  def cleanup_file_cache
63
63
  unless Chef::Config[:solo_legacy_mode] || skip_removal
64
- if Chef::Config.target_mode?
65
- TargetIO::FileUtils.rm_rf(Chef::Config[:file_cache_path])
66
- return
67
- end
68
-
69
64
  # Delete each file in the cache that we didn't encounter in the
70
65
  # manifest.
71
66
  cache.find(File.join(%w{cookbooks ** {*,.*}})).each do |cache_filename|
@@ -90,7 +90,6 @@ class Chef
90
90
  def process_events_until_done
91
91
  call_subscribers(*event_list.shift) until event_list.empty?
92
92
  end
93
-
94
93
  end
95
94
  end
96
95
  end
@@ -170,7 +170,7 @@ class Chef
170
170
  class PowershellCmdletException < RuntimeError; end
171
171
  class LCMParser < RuntimeError; end
172
172
 
173
- class CannotDetermineHomebrewOwner < Package; end
173
+ class CannotDetermineHomebrewPath < Package; end
174
174
  class CannotDetermineWindowsInstallerType < Package; end
175
175
  class NoWindowsPackageSource < Package; end
176
176
 
@@ -29,7 +29,7 @@ class Chef
29
29
  module ClassMethods
30
30
  # We want to mix these in as class methods
31
31
  def writable?(path)
32
- ::TargetIO::File.writable?(path)
32
+ ::File.writable?(path)
33
33
  end
34
34
  end
35
35
 
@@ -120,7 +120,7 @@ class Chef
120
120
  return nil if resource.nil? || resource.group.nil?
121
121
 
122
122
  if resource.group.is_a?(String)
123
- diminished_radix_complement( TargetIO::Etc.getgrnam(resource.group).gid )
123
+ diminished_radix_complement( Etc.getgrnam(resource.group).gid )
124
124
  elsif resource.group.is_a?(Integer)
125
125
  resource.group
126
126
  else
@@ -222,9 +222,9 @@ class Chef
222
222
 
223
223
  def stat
224
224
  if manage_symlink_attrs?
225
- @stat ||= TargetIO::File.lstat(file)
225
+ @stat ||= File.lstat(file)
226
226
  else
227
- @stat ||= TargetIO::File.stat(file)
227
+ @stat ||= File.stat(file)
228
228
  end
229
229
  end
230
230
 
@@ -237,20 +237,20 @@ class Chef
237
237
  def chmod(mode, file)
238
238
  if manage_symlink_attrs?
239
239
  begin
240
- TargetIO::File.lchmod(mode, file)
240
+ File.lchmod(mode, file)
241
241
  rescue NotImplementedError
242
242
  Chef::Log.warn("#{file} mode not changed: File.lchmod is unimplemented on this OS and Ruby version")
243
243
  end
244
244
  else
245
- TargetIO::File.chmod(mode, file)
245
+ File.chmod(mode, file)
246
246
  end
247
247
  end
248
248
 
249
249
  def chown(uid, gid, file)
250
250
  if manage_symlink_attrs?
251
- TargetIO::File.lchown(uid, gid, file)
251
+ File.lchown(uid, gid, file)
252
252
  else
253
- TargetIO::File.chown(uid, gid, file)
253
+ File.chown(uid, gid, file)
254
254
  end
255
255
  end
256
256
 
@@ -269,7 +269,7 @@ class Chef
269
269
  return nil if resource.nil? || resource.owner.nil?
270
270
 
271
271
  if resource.owner.is_a?(String)
272
- diminished_radix_complement( TargetIO::Etc.getpwnam(resource.owner).uid )
272
+ diminished_radix_complement( Etc.getpwnam(resource.owner).uid )
273
273
  elsif resource.owner.is_a?(Integer)
274
274
  resource.owner
275
275
  else
@@ -18,7 +18,6 @@
18
18
 
19
19
  require_relative "deploy/cp"
20
20
  require_relative "deploy/mv_unix"
21
- require_relative "deploy/target_io"
22
21
  if ChefUtils.windows?
23
22
  require_relative "deploy/mv_windows"
24
23
  end
@@ -27,9 +26,7 @@ class Chef
27
26
  class FileContentManagement
28
27
  class Deploy
29
28
  def self.strategy(atomic_update)
30
- if ChefConfig::Config.target_mode?
31
- TargetIO::Deploy.new
32
- elsif atomic_update
29
+ if atomic_update
33
30
  ChefUtils.windows? ? MvWindows.new : MvUnix.new
34
31
  else
35
32
  Cp.new
@@ -23,9 +23,7 @@ class Chef
23
23
  module FileClass
24
24
 
25
25
  def file_class
26
- @host_os_file ||= if ChefConfig::Config.target_mode?
27
- ::TargetIO::File
28
- elsif ChefUtils.windows?
26
+ @host_os_file ||= if ChefUtils.windows?
29
27
  require_relative "../win32/file"
30
28
  Chef::ReservedNames::Win32::File
31
29
  else
@@ -38,7 +38,7 @@ class Chef
38
38
 
39
39
  # if we're passed something that looks like a filesystem path, with no source, use it
40
40
  # - require at least one '/' in the path to avoid gem_package "foo" breaking if a file named 'foo' exists in the cwd
41
- if new_resource.source.nil? && new_resource.package_name.include?(::File::SEPARATOR) && ::TargetIO::File.exist?(new_resource.package_name)
41
+ if new_resource.source.nil? && new_resource.package_name.include?(::File::SEPARATOR) && ::File.exist?(new_resource.package_name)
42
42
  Chef::Log.trace("No package source specified, but #{new_resource.package_name} exists on the filesystem, copying to package source")
43
43
  new_resource.source(new_resource.package_name)
44
44
  end
@@ -27,7 +27,7 @@ require "etc" unless defined?(Etc)
27
27
 
28
28
  class Chef
29
29
  module Mixin
30
- module HomebrewUser
30
+ module Homebrew
31
31
  include Chef::Mixin::ShellOut
32
32
 
33
33
  ##
@@ -57,15 +57,19 @@ class Chef
57
57
  @homebrew_owner_username
58
58
  end
59
59
 
60
+ # Use homebrew_bin_path to return the path to the brew binary
61
+ # @param [String, Array(String)] brew_bin_path
62
+ # @return [String] path to the brew binary
60
63
  def homebrew_bin_path(brew_bin_path = nil)
61
64
  if brew_bin_path && ::File.exist?(brew_bin_path)
62
65
  brew_bin_path
63
66
  else
64
- [which("brew"), "/opt/homebrew/bin/brew", "/usr/local/bin/brew", "/home/linuxbrew/.linuxbrew/bin/brew"].uniq.select do |x|
65
- next if x == false
67
+ brew_path = which("brew", prepend_path: %w{/opt/homebrew/bin /usr/local/bin /home/linuxbrew/.linuxbrew/bin})
68
+ unless brew_path
69
+ raise Chef::Exceptions::CannotDetermineHomebrewPath, 'Couldn\'t find the "brew" executable anywhere on the path.'
70
+ end
66
71
 
67
- ::File.exist?(x) && ::File.executable?(x)
68
- end.first || nil
72
+ brew_path
69
73
  end
70
74
  end
71
75
 
@@ -73,18 +77,11 @@ class Chef
73
77
 
74
78
  def calculate_owner
75
79
  brew_path = homebrew_bin_path
76
- if brew_path
77
- # By default, this follows symlinks which is what we want
78
- owner = ::File.stat(brew_path).uid
79
- else
80
- raise Chef::Exceptions::CannotDetermineHomebrewOwner,
81
- 'Couldn\'t find the "brew" executable anywhere on the path.'
82
- end
83
-
84
- Chef::Log.debug "Found Homebrew owner #{Etc.getpwuid(owner).name}; executing `brew` commands as them"
85
- owner
80
+ # By default, this follows symlinks which is what we want
81
+ owner_uid = ::File.stat(brew_path).uid
82
+ Chef::Log.debug "Found Homebrew owner #{Etc.getpwuid(owner_uid).name}; executing `brew` commands as them"
83
+ owner_uid
86
84
  end
87
-
88
85
  end
89
86
  end
90
87
  end
@@ -170,18 +170,7 @@ class Chef
170
170
  key_content = ::File.exist?(priv_key) ? File.read(priv_key) : priv_key
171
171
  key = ::OpenSSL::PKey::EC.new key_content, priv_key_password
172
172
 
173
- # Get curve type (prime256v1...)
174
- group = ::OpenSSL::PKey::EC::Group.new(key.group.curve_name)
175
- # Get Generator point & public point (priv * generator)
176
- generator = group.generator
177
- pub_point = generator.mul(key.private_key)
178
- key.public_key = pub_point
179
-
180
- # Public Key in pem
181
- public_key = ::OpenSSL::PKey::EC.new
182
- public_key.group = group
183
- public_key.public_key = pub_point
184
- public_key.to_pem
173
+ key.public_to_pem
185
174
  end
186
175
 
187
176
  # generate a pem file given a cipher, key, an optional key_password
@@ -22,7 +22,7 @@ class Chef
22
22
  class Provider
23
23
  class CookbookFile < Chef::Provider::File
24
24
 
25
- provides :cookbook_file, target_mode: true
25
+ provides :cookbook_file
26
26
 
27
27
  def initialize(new_resource, run_context)
28
28
  @content_class = Chef::Provider::CookbookFile::Content
@@ -22,7 +22,7 @@ class Chef
22
22
  class Provider
23
23
  class Cron < Chef::Provider
24
24
 
25
- provides :cron, os: ["!aix", "!solaris2"], target_mode: true
25
+ provides :cron, os: ["!aix", "!solaris2"]
26
26
 
27
27
  SPECIAL_TIME_VALUES = %i{reboot yearly annually monthly weekly daily midnight hourly}.freeze
28
28
  CRON_ATTRIBUTES = %i{minute hour day month weekday time command mailto path shell home environment}.freeze
@@ -27,12 +27,12 @@ class Chef
27
27
  class Provider
28
28
  class Directory < Chef::Provider::File
29
29
 
30
- provides :directory, target_mode: true
30
+ provides :directory
31
31
 
32
32
  def load_current_resource
33
33
  @current_resource = Chef::Resource::Directory.new(new_resource.name)
34
34
  current_resource.path(new_resource.path)
35
- if ::TargetIO::File.exist?(current_resource.path) && @action != :create_if_missing
35
+ if ::File.exist?(current_resource.path) && @action != :create_if_missing
36
36
  load_resource_attributes_from_file(current_resource)
37
37
  end
38
38
  current_resource
@@ -50,15 +50,15 @@ class Chef
50
50
  if new_resource.recursive
51
51
  does_parent_exist = lambda do |base_dir|
52
52
  base_dir = ::File.dirname(base_dir)
53
- if ::TargetIO::File.exist?(base_dir)
54
- ::TargetIO::File.directory?(base_dir)
53
+ if ::File.exist?(base_dir)
54
+ ::File.directory?(base_dir)
55
55
  else
56
56
  does_parent_exist.call(base_dir)
57
57
  end
58
58
  end
59
59
  does_parent_exist.call(new_resource.path)
60
60
  else
61
- ::TargetIO::File.directory?(parent_directory)
61
+ ::File.directory?(parent_directory)
62
62
  end
63
63
  end
64
64
  a.failure_message(Chef::Exceptions::EnclosingDirectoryDoesNotExist, "Parent directory #{parent_directory} does not exist, cannot create #{new_resource.path}")
@@ -73,7 +73,7 @@ class Chef
73
73
  # make sure we have write permissions to that directory
74
74
  is_parent_writable = lambda do |base_dir|
75
75
  base_dir = ::File.dirname(base_dir)
76
- if ::TargetIO::File.exist?(base_dir)
76
+ if ::File.exist?(base_dir)
77
77
  if Chef::FileAccessControl.writable?(base_dir)
78
78
  true
79
79
  elsif Chef::Util::PathHelper.is_sip_path?(base_dir, node)
@@ -89,7 +89,7 @@ class Chef
89
89
  else
90
90
  # in why run mode & parent directory does not exist no permissions check is required
91
91
  # If not in why run, permissions must be valid and we rely on prior assertion that dir exists
92
- if !whyrun_mode? || ::TargetIO::File.exist?(parent_directory)
92
+ if !whyrun_mode? || ::File.exist?(parent_directory)
93
93
  if Chef::FileAccessControl.writable?(parent_directory)
94
94
  true
95
95
  elsif Chef::Util::PathHelper.is_sip_path?(parent_directory, node)
@@ -108,8 +108,8 @@ class Chef
108
108
 
109
109
  requirements.assert(:delete) do |a|
110
110
  a.assertion do
111
- if ::TargetIO::File.exist?(new_resource.path)
112
- ::TargetIO::File.directory?(new_resource.path) && Chef::FileAccessControl.writable?(new_resource.path)
111
+ if ::File.exist?(new_resource.path)
112
+ ::File.directory?(new_resource.path) && Chef::FileAccessControl.writable?(new_resource.path)
113
113
  else
114
114
  true
115
115
  end
@@ -122,12 +122,12 @@ class Chef
122
122
  end
123
123
 
124
124
  action :create, description: "Create a directory. If a directory already exists (but does not match), update that directory to match." do
125
- unless ::TargetIO::File.exist?(new_resource.path)
125
+ unless ::File.exist?(new_resource.path)
126
126
  converge_by("create new directory #{new_resource.path}") do
127
127
  if new_resource.recursive == true
128
- ::TargetIO::FileUtils.mkdir_p(new_resource.path)
128
+ ::FileUtils.mkdir_p(new_resource.path)
129
129
  else
130
- ::TargetIO::Dir.mkdir(new_resource.path)
130
+ ::Dir.mkdir(new_resource.path)
131
131
  end
132
132
  logger.info("#{new_resource} created directory #{new_resource.path}")
133
133
  end
@@ -138,15 +138,15 @@ class Chef
138
138
  end
139
139
 
140
140
  action :delete, description: "Delete a directory." do
141
- if ::TargetIO::File.exist?(new_resource.path)
141
+ if ::File.exist?(new_resource.path)
142
142
  converge_by("delete existing directory #{new_resource.path}") do
143
143
  if new_resource.recursive == true
144
144
  # we don't use rm_rf here because it masks all errors, including
145
145
  # IO errors or permission errors that would prevent the deletion
146
- ::TargetIO::FileUtils.rm_r(new_resource.path)
146
+ FileUtils.rm_r(new_resource.path)
147
147
  logger.info("#{new_resource} deleted #{new_resource.path} recursively")
148
148
  else
149
- ::TargetIO::Dir.delete(new_resource.path)
149
+ ::Dir.delete(new_resource.path)
150
150
  logger.info("#{new_resource} deleted #{new_resource.path}")
151
151
  end
152
152
  end