chef 17.10.114-universal-mingw32 → 17.10.163-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +10 -2
- data/chef-universal-mingw32.gemspec +1 -1
- data/chef.gemspec +11 -6
- data/lib/chef/client.rb +0 -31
- data/lib/chef/http/ssl_policies.rb +3 -3
- data/lib/chef/mixin/openssl_helper.rb +17 -13
- data/lib/chef/provider/cron.rb +5 -1
- data/lib/chef/provider/package/chocolatey.rb +3 -7
- data/lib/chef/provider/package/yum/yum_helper.py +2 -14
- data/lib/chef/provider/service/windows.rb +0 -1
- data/lib/chef/resource/chef_client_config.rb +4 -2
- data/lib/chef/resource/support/client.erb +4 -3
- data/lib/chef/secret_fetcher/azure_key_vault.rb +3 -3
- data/lib/chef/version.rb +1 -1
- data/spec/functional/assets/yumrepo-empty/repodata/01a3b-filelists.sqlite.bz2 +0 -0
- data/spec/functional/assets/yumrepo-empty/repodata/401dc-filelists.xml.gz +0 -0
- data/spec/functional/assets/yumrepo-empty/repodata/5dc1e-primary.sqlite.bz2 +0 -0
- data/spec/functional/assets/yumrepo-empty/repodata/6bf96-other.xml.gz +0 -0
- data/spec/functional/assets/yumrepo-empty/repodata/7c365-other.sqlite.bz2 +0 -0
- data/spec/functional/assets/yumrepo-empty/repodata/dabe2-primary.xml.gz +0 -0
- data/spec/functional/assets/yumrepo-empty/repodata/repomd.xml +55 -0
- data/spec/functional/resource/chocolatey_package_spec.rb +2 -2
- data/spec/functional/resource/group_spec.rb +38 -18
- data/spec/functional/resource/yum_package_spec.rb +16 -0
- data/spec/functional/win32/registry_spec.rb +3 -0
- data/spec/integration/client/fips_spec.rb +29 -0
- data/spec/integration/client/open_ssl_spec.rb +20 -0
- data/spec/spec_helper.rb +5 -0
- data/spec/support/platform_helpers.rb +8 -0
- data/spec/unit/client_spec.rb +0 -19
- data/spec/unit/mixin/openssl_helper_spec.rb +1 -1
- data/spec/unit/provider/cron_spec.rb +34 -0
- data/spec/unit/provider/package/chocolatey_spec.rb +7 -6
- data/spec/unit/resource_spec.rb +1 -8
- metadata +33 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d29882e41716492dc7cac42ee8081c14b10f7eab0db4b0c9d7c5c92a3409f465
|
4
|
+
data.tar.gz: 6b84b5e5aacb082f10bfe1abb1406c5b762b968d925e319d04fef1c95ef45079
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e8c8b2a4e4801cb41cb5571d8d8cc8fcd21c5b1311552cf42213ff705aeb65e3454c975b29e64b5501b28ce2e2647195b2d9655bd1616daf46d13a4728f1d65
|
7
|
+
data.tar.gz: 75522296c3bcdf1ed1f103a12d80de241db2ce8e030e3b3a35ab72fac8c42afaa973c108a63f3f29081739e5129e616756fc55efd65eb12e541026cec1766357
|
data/Gemfile
CHANGED
@@ -18,12 +18,19 @@ end
|
|
18
18
|
gem "cheffish", "~> 17.0.0"
|
19
19
|
|
20
20
|
gem "ast", "~> 2.4.2"
|
21
|
-
gem "rubocop-ast", ">= 1.
|
21
|
+
gem "rubocop-ast", ">= 1.31.0"
|
22
|
+
|
23
|
+
gem "rdoc", "~> 6.3.4" # 6.3.4.1 required for CVE-2024-27281, allow patch upgrades
|
24
|
+
|
25
|
+
# Verify and macOS bring their own ruby setups are inconsistent with our OpenSSL configurations
|
26
|
+
install_if -> { RUBY_PLATFORM !~ /darwin/ && ENV["BUILDKITE_PIPELINE_SLUG"] !~ /verify/ } do
|
27
|
+
gem "openssl", "= 3.2.0"
|
28
|
+
end
|
22
29
|
|
23
30
|
group(:omnibus_package) do
|
24
31
|
gem "appbundler"
|
25
32
|
gem "rb-readline"
|
26
|
-
gem "inspec-core-bin", "~> 5.22.
|
33
|
+
gem "inspec-core-bin", "~> 5.22.40" # need to provide the binaries for inspec
|
27
34
|
gem "chef-vault"
|
28
35
|
end
|
29
36
|
|
@@ -49,6 +56,7 @@ group(:development, :test) do
|
|
49
56
|
gem "rake"
|
50
57
|
gem "rspec"
|
51
58
|
gem "webmock"
|
59
|
+
gem "crack", "< 0.4.6" # due to https://github.com/jnunemaker/crack/pull/75
|
52
60
|
gem "fauxhai-ng" # for chef-utils gem
|
53
61
|
end
|
54
62
|
|
@@ -15,7 +15,7 @@ gemspec.add_dependency "win32-taskscheduler", "~> 2.0"
|
|
15
15
|
gemspec.add_dependency "win32-certstore", "~> 0.6.15"
|
16
16
|
gemspec.add_dependency "wmi-lite", "~> 1.0"
|
17
17
|
gemspec.add_dependency "iso8601", ">= 0.12.1", "< 0.14" # validate 0.14 when it comes out
|
18
|
-
gemspec.add_dependency "chef-powershell", "~> 1.0
|
18
|
+
gemspec.add_dependency "chef-powershell" , "~> 18.1.0"
|
19
19
|
gemspec.extensions << "ext/win32-eventlog/Rakefile"
|
20
20
|
gemspec.files += Dir.glob("{distro,ext}/**/*")
|
21
21
|
|
data/chef.gemspec
CHANGED
@@ -22,11 +22,11 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.email = "adam@chef.io"
|
23
23
|
s.homepage = "https://www.chef.io"
|
24
24
|
|
25
|
-
s.required_ruby_version = ">=
|
25
|
+
s.required_ruby_version = ">= 3.0.0"
|
26
26
|
|
27
27
|
s.add_dependency "chef-config", "= #{Chef::VERSION}"
|
28
28
|
s.add_dependency "chef-utils", "= #{Chef::VERSION}"
|
29
|
-
s.add_dependency "train-core", "~> 3.10"
|
29
|
+
s.add_dependency "train-core", "~> 3.10", "< 3.12.5"
|
30
30
|
s.add_dependency "train-winrm", ">= 0.2.5"
|
31
31
|
|
32
32
|
s.add_dependency "license-acceptance", ">= 1.0.5", "< 3"
|
@@ -35,8 +35,8 @@ Gem::Specification.new do |s|
|
|
35
35
|
s.add_dependency "mixlib-authentication", ">= 2.1", "< 4"
|
36
36
|
s.add_dependency "mixlib-shellout", ">= 3.1.1", "< 4.0"
|
37
37
|
s.add_dependency "mixlib-archive", ">= 0.4", "< 2.0"
|
38
|
-
s.add_dependency "ohai", "~> 17.
|
39
|
-
s.add_dependency "inspec-core", "~> 5.22.
|
38
|
+
s.add_dependency "ohai", "~> 17.9"
|
39
|
+
s.add_dependency "inspec-core", "~> 5.22.40"
|
40
40
|
|
41
41
|
s.add_dependency "ffi", "~> 1.15.5"
|
42
42
|
s.add_dependency "ffi-yajl", ">= 2.2", "< 4.0"
|
@@ -54,14 +54,19 @@ Gem::Specification.new do |s|
|
|
54
54
|
s.add_dependency "uuidtools", ">= 2.1.5", "< 3.0" # osx_profile resource
|
55
55
|
s.add_dependency "corefoundation", "~> 0.3.4" # macos_userdefaults resource
|
56
56
|
|
57
|
-
s.add_dependency "
|
57
|
+
s.add_dependency "proxifier2", "~> 1.1"
|
58
58
|
|
59
59
|
s.add_dependency "aws-sdk-s3", "~> 1.91" # s3 recipe-url support
|
60
60
|
s.add_dependency "aws-sdk-secretsmanager", "~> 1.46"
|
61
|
-
s.add_dependency "vault", "~> 0.
|
61
|
+
s.add_dependency "vault", "~> 0.18.2" # hashi vault official client gem
|
62
62
|
s.bindir = "bin"
|
63
63
|
s.executables = %w{ }
|
64
64
|
|
65
|
+
if RUBY_VERSION.match?("3.0.0")
|
66
|
+
# Ruby 3.0.0 on Fedora specifically makes trouble
|
67
|
+
s.add_dependency "uri", "= 0.10.1"
|
68
|
+
end
|
69
|
+
|
65
70
|
s.require_paths = %w{ lib }
|
66
71
|
s.files = %w{Gemfile Rakefile LICENSE README.md} +
|
67
72
|
Dir.glob("{lib,spec}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) } +
|
data/lib/chef/client.rb
CHANGED
@@ -292,8 +292,6 @@ class Chef
|
|
292
292
|
# keep this inside the main loop to get exception backtraces
|
293
293
|
end_profiling
|
294
294
|
|
295
|
-
warn_if_eol
|
296
|
-
|
297
295
|
# rebooting has to be the last thing we do, no exceptions.
|
298
296
|
Chef::Platform::Rebooter.reboot_if_needed!(node)
|
299
297
|
rescue Exception => run_error
|
@@ -322,35 +320,6 @@ class Chef
|
|
322
320
|
# @todo make this stuff protected or private
|
323
321
|
#
|
324
322
|
|
325
|
-
# @api private
|
326
|
-
def warn_if_eol
|
327
|
-
require_relative "version"
|
328
|
-
|
329
|
-
# New Date format is YYYY-MM-DD or false
|
330
|
-
new_date = eol_override
|
331
|
-
|
332
|
-
# We make a release every year so take the version you're on + 2006 and you get
|
333
|
-
# the year it goes EOL. 1/8/2024 - EOL for Chef-17 is now November 1, 2024
|
334
|
-
# eol_year = 2006 + Gem::Version.new(Chef::VERSION).segments.first
|
335
|
-
eol_year = "2024"
|
336
|
-
cut_off_date = !!new_date ? Time.parse(new_date) : Time.new(eol_year, 11, 30)
|
337
|
-
|
338
|
-
return if Time.now < cut_off_date
|
339
|
-
|
340
|
-
logger.warn("This release of #{ChefUtils::Dist::Infra::PRODUCT} became end of life (EOL) on #{cut_off_date.strftime("%b %d, %Y")}. Please update to a supported release to receive new features, bug fixes, and security updates.")
|
341
|
-
end
|
342
|
-
|
343
|
-
def eol_override
|
344
|
-
# If you want to override the existing EOL date, add a file in the root of Chef
|
345
|
-
# put a date in it in the form of YYYY-DD-MM.
|
346
|
-
override_file = "EOL_override"
|
347
|
-
if File.exist?(override_file)
|
348
|
-
File.read(File.expand_path(override_file)).strip
|
349
|
-
else
|
350
|
-
false
|
351
|
-
end
|
352
|
-
end
|
353
|
-
|
354
323
|
# @api private
|
355
324
|
def configure_formatters
|
356
325
|
formatters_for_run.map do |formatter_name, output_path|
|
@@ -103,10 +103,10 @@ class Chef
|
|
103
103
|
unless config[:ssl_client_cert] && config[:ssl_client_key]
|
104
104
|
raise Chef::Exceptions::ConfigurationError, "You must configure ssl_client_cert and ssl_client_key together"
|
105
105
|
end
|
106
|
-
unless ::File.
|
106
|
+
unless ::File.exist?(config[:ssl_client_cert])
|
107
107
|
raise Chef::Exceptions::ConfigurationError, "The configured ssl_client_cert #{config[:ssl_client_cert]} does not exist"
|
108
108
|
end
|
109
|
-
unless ::File.
|
109
|
+
unless ::File.exist?(config[:ssl_client_key])
|
110
110
|
raise Chef::Exceptions::ConfigurationError, "The configured ssl_client_key #{config[:ssl_client_key]} does not exist"
|
111
111
|
end
|
112
112
|
|
@@ -132,7 +132,7 @@ class Chef
|
|
132
132
|
def add_trusted_cert(cert)
|
133
133
|
http_client.cert_store.add_cert(cert)
|
134
134
|
rescue OpenSSL::X509::StoreError => e
|
135
|
-
raise e unless e.message
|
135
|
+
raise e unless e.message =~ /cert already in hash table/
|
136
136
|
end
|
137
137
|
|
138
138
|
end
|
@@ -157,7 +157,7 @@ class Chef
|
|
157
157
|
raise TypeError, "curve must be a string" unless curve.is_a?(String)
|
158
158
|
raise ArgumentError, "Specified curve is not available on this system" unless %w{prime256v1 secp384r1 secp521r1}.include?(curve)
|
159
159
|
|
160
|
-
::OpenSSL::PKey::EC.
|
160
|
+
::OpenSSL::PKey::EC.generate(curve)
|
161
161
|
end
|
162
162
|
|
163
163
|
# generate pem format of the public key given a private key
|
@@ -170,18 +170,22 @@ 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
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
173
|
+
if windows? || macos? || aix?
|
174
|
+
# Get curve type (prime256v1...)
|
175
|
+
group = ::OpenSSL::PKey::EC::Group.new(key.group.curve_name)
|
176
|
+
# Get Generator point & public point (priv * generator)
|
177
|
+
generator = group.generator
|
178
|
+
pub_point = generator.mul(key.private_key)
|
179
|
+
key.public_key = pub_point
|
180
|
+
|
181
|
+
# Public Key in pem
|
182
|
+
public_key = ::OpenSSL::PKey::EC.new
|
183
|
+
public_key.group = group
|
184
|
+
public_key.public_key = pub_point
|
185
|
+
public_key.to_pem
|
186
|
+
else
|
187
|
+
key.public_to_pem
|
188
|
+
end
|
185
189
|
end
|
186
190
|
|
187
191
|
# generate a pem file given a cipher, key, an optional key_password
|
data/lib/chef/provider/cron.rb
CHANGED
@@ -88,7 +88,11 @@ class Chef
|
|
88
88
|
|
89
89
|
def cron_different?
|
90
90
|
CRON_ATTRIBUTES.any? do |cron_var|
|
91
|
-
new_resource.send(cron_var)
|
91
|
+
if new_resource.send(cron_var).class == current_resource.send(cron_var).class
|
92
|
+
new_resource.send(cron_var) != current_resource.send(cron_var)
|
93
|
+
else
|
94
|
+
new_resource.send(cron_var).to_s != current_resource.send(cron_var).to_s
|
95
|
+
end
|
92
96
|
end
|
93
97
|
end
|
94
98
|
|
@@ -130,21 +130,17 @@ class Chef
|
|
130
130
|
# install from, but like the rubygem provider's sources which are more like repos.
|
131
131
|
def check_resource_semantics!; end
|
132
132
|
|
133
|
-
def
|
134
|
-
@get_choco_version ||= powershell_exec!("
|
133
|
+
def get_choco_version
|
134
|
+
@get_choco_version ||= powershell_exec!("#{choco_exe} --version").result
|
135
135
|
end
|
136
136
|
|
137
137
|
# Choco V2 uses 'Search' for remote repositories and 'List' for local packages
|
138
|
-
def
|
138
|
+
def query_command
|
139
139
|
return "list" if get_choco_version.match?(/^1/)
|
140
140
|
|
141
141
|
"search"
|
142
142
|
end
|
143
143
|
|
144
|
-
def query_command
|
145
|
-
self.class.query_command
|
146
|
-
end
|
147
|
-
|
148
144
|
private
|
149
145
|
|
150
146
|
def version_compare(v1, v2)
|
@@ -53,16 +53,14 @@ def install_only_packages(base, name):
|
|
53
53
|
outpipe.flush()
|
54
54
|
|
55
55
|
def query(base, command):
|
56
|
-
enabled_repos = base.repos.listEnabled()
|
57
|
-
|
58
56
|
# Handle any repocontrols passed in with our options
|
59
57
|
|
60
58
|
if 'repos' in command:
|
61
59
|
for repo in command['repos']:
|
62
60
|
if 'enable' in repo:
|
63
61
|
base.repos.enableRepo(repo['enable'])
|
64
|
-
|
65
|
-
|
62
|
+
if 'disable' in repo:
|
63
|
+
base.repos.disableRepo(repo['disable'])
|
66
64
|
|
67
65
|
args = { 'name': command['provides'] }
|
68
66
|
do_nevra = False
|
@@ -123,16 +121,6 @@ def query(base, command):
|
|
123
121
|
outpipe.write("%(n)s %(e)s:%(v)s-%(r)s %(a)s\n" % { 'n': pkg.name, 'e': pkg.epoch, 'v': pkg.version, 'r': pkg.release, 'a': pkg.arch })
|
124
122
|
outpipe.flush()
|
125
123
|
|
126
|
-
# Reset any repos we were passed in enablerepo/disablerepo to the original state in enabled_repos
|
127
|
-
if 'repos' in command:
|
128
|
-
for repo in command['repos']:
|
129
|
-
if 'enable' in repo:
|
130
|
-
if base.repos.getRepo(repo['enable']) not in enabled_repos:
|
131
|
-
base.repos.disableRepo(repo['enable'])
|
132
|
-
if 'disable' in repo:
|
133
|
-
if base.repos.getRepo(repo['disable']) in enabled_repos:
|
134
|
-
base.repos.enableRepo(repo['disable'])
|
135
|
-
|
136
124
|
# the design of this helper is that it should try to be 'brittle' and fail hard and exit in order
|
137
125
|
# to keep process tables clean. additional error handling should probably be added to the retry loop
|
138
126
|
# on the ruby side.
|
@@ -74,7 +74,6 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
|
|
74
74
|
current_resource.run_as_user(config_info.service_start_name) if config_info.service_start_name
|
75
75
|
current_resource.display_name(config_info.display_name) if config_info.display_name
|
76
76
|
current_resource.delayed_start(current_delayed_start) if current_delayed_start
|
77
|
-
current_resource.description(config_info.description) if new_resource.description
|
78
77
|
end
|
79
78
|
|
80
79
|
current_resource
|
@@ -196,10 +196,12 @@ class Chef
|
|
196
196
|
|
197
197
|
property :policy_persist_run_list, [true, false],
|
198
198
|
description: "Override run lists defined in a Policyfile with the `run_list` defined on the #{ChefUtils::Dist::Server::PRODUCT}.",
|
199
|
-
introduced: "17.3"
|
199
|
+
introduced: "17.3",
|
200
|
+
default: false
|
200
201
|
|
201
202
|
property :minimal_ohai, [true, false],
|
202
|
-
description: "Run a minimal set of Ohai plugins providing data necessary for the execution of #{ChefUtils::Dist::Infra::PRODUCT}'s built-in resources. Setting this to true will skip many large and time consuming data sets such as `cloud` or `packages`. Setting this
|
203
|
+
description: "Run a minimal set of Ohai plugins providing data necessary for the execution of #{ChefUtils::Dist::Infra::PRODUCT}'s built-in resources. Setting this to true will skip many large and time consuming data sets such as `cloud` or `packages`. Setting this to true may break cookbooks that assume all Ohai data will be present.",
|
204
|
+
default: false
|
203
205
|
|
204
206
|
property :start_handlers, Array,
|
205
207
|
description: %q(An array of hashes that contain a report handler class and the arguments to pass to that class on initialization. The hash should include `class` and `argument` keys where `class` is a String and `argument` is an array of quoted String values. For example: `[{'class' => 'MyHandler', %w('"argument1"', '"argument2"')}]`),
|
@@ -10,18 +10,19 @@
|
|
10
10
|
@https_proxy
|
11
11
|
@ftp_proxy
|
12
12
|
@log_level
|
13
|
-
@minimal_ohai
|
14
13
|
@named_run_list
|
15
14
|
@no_proxy
|
16
15
|
@pid_file
|
17
16
|
@policy_group
|
18
17
|
@policy_name
|
19
18
|
@rubygems_url
|
20
|
-
@ssl_verify_mode
|
21
|
-
@policy_persist_run_list).each do |prop| -%>
|
19
|
+
@ssl_verify_mode).each do |prop| -%>
|
22
20
|
<% next if instance_variable_get(prop).nil? || instance_variable_get(prop).empty? -%>
|
23
21
|
<%=prop.delete_prefix("@") %> <%= instance_variable_get(prop).inspect %>
|
24
22
|
<% end -%>
|
23
|
+
<%# boolean properties are neither .nil? nor respond to .empty? so they are included below %>
|
24
|
+
minimal_ohai <%= @minimal_ohai.inspect %>
|
25
|
+
policy_persist_run_list <%= @policy_persist_run_list.inspect %>
|
25
26
|
<%# ohai_disabled_plugins and ohai_optional_plugins properties don't match the config value perfectly-%>
|
26
27
|
<% %w(@ohai_disabled_plugins
|
27
28
|
@ohai_optional_plugins).each do |prop| -%>
|
@@ -59,7 +59,7 @@ class Chef
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def validate!
|
62
|
-
raise Chef::Exceptions::Secret::ConfigurationInvalid, "You may only specify one (these are mutually exclusive): :
|
62
|
+
raise Chef::Exceptions::Secret::ConfigurationInvalid, "You may only specify one (these are mutually exclusive): :config_object_id, :client_id, or :mi_res_id" if [config_object_id, client_id, mi_res_id].count { |x| !x.nil? } > 1
|
63
63
|
end
|
64
64
|
|
65
65
|
private
|
@@ -87,7 +87,7 @@ class Chef
|
|
87
87
|
"https://vault.azure.net"
|
88
88
|
end
|
89
89
|
|
90
|
-
def
|
90
|
+
def config_object_id
|
91
91
|
config[:object_id]
|
92
92
|
end
|
93
93
|
|
@@ -104,7 +104,7 @@ class Chef
|
|
104
104
|
p = {}
|
105
105
|
p["api-version"] = api_version
|
106
106
|
p["resource"] = resource
|
107
|
-
p["object_id"] =
|
107
|
+
p["object_id"] = config_object_id if config_object_id
|
108
108
|
p["client_id"] = client_id if client_id
|
109
109
|
p["mi_res_id"] = mi_res_id if mi_res_id
|
110
110
|
URI.encode_www_form(p)
|
data/lib/chef/version.rb
CHANGED
Binary file
|
Binary file
|
@@ -0,0 +1,55 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<repomd xmlns="http://linux.duke.edu/metadata/repo" xmlns:rpm="http://linux.duke.edu/metadata/rpm">
|
3
|
+
<revision>1667508211</revision>
|
4
|
+
<data type="filelists">
|
5
|
+
<checksum type="sha256">401dc19bda88c82c403423fb835844d64345f7e95f5b9835888189c03834cc93</checksum>
|
6
|
+
<open-checksum type="sha256">bf9808b81cb2dbc54b4b8e35adc584ddcaa73bd81f7088d73bf7dbbada961310</open-checksum>
|
7
|
+
<location href="repodata/401dc-filelists.xml.gz"/>
|
8
|
+
<timestamp>1667508211</timestamp>
|
9
|
+
<size>123</size>
|
10
|
+
<open-size>125</open-size>
|
11
|
+
</data>
|
12
|
+
<data type="primary">
|
13
|
+
<checksum type="sha256">dabe2ce5481d23de1f4f52bdcfee0f9af98316c9e0de2ce8123adeefa0dd08b9</checksum>
|
14
|
+
<open-checksum type="sha256">e1e2ffd2fb1ee76f87b70750d00ca5677a252b397ab6c2389137a0c33e7b359f</open-checksum>
|
15
|
+
<location href="repodata/dabe2-primary.xml.gz"/>
|
16
|
+
<timestamp>1667508211</timestamp>
|
17
|
+
<size>134</size>
|
18
|
+
<open-size>167</open-size>
|
19
|
+
</data>
|
20
|
+
<data type="primary_db">
|
21
|
+
<checksum type="sha256">5dc1e6e73c84803f059bb3065e684e56adfc289a7e398946574d79dac6643945</checksum>
|
22
|
+
<open-checksum type="sha256">f0d550414e8f2e960e82e704549364299ca9e3e8664ad4faffd208262c3b6d12</open-checksum>
|
23
|
+
<location href="repodata/5dc1e-primary.sqlite.bz2"/>
|
24
|
+
<timestamp>1667508211</timestamp>
|
25
|
+
<database_version>10</database_version>
|
26
|
+
<size>1131</size>
|
27
|
+
<open-size>21504</open-size>
|
28
|
+
</data>
|
29
|
+
<data type="other_db">
|
30
|
+
<checksum type="sha256">7c36572015e075add2b38b900837bcdbb8a504130ddff49b2351a7fc0affa3d4</checksum>
|
31
|
+
<open-checksum type="sha256">4de0fe7c5dd2674849a7c63c326e42f33af0a0f46219bc6dd59f51dfa2ac8c68</open-checksum>
|
32
|
+
<location href="repodata/7c365-other.sqlite.bz2"/>
|
33
|
+
<timestamp>1667508211</timestamp>
|
34
|
+
<database_version>10</database_version>
|
35
|
+
<size>575</size>
|
36
|
+
<open-size>6144</open-size>
|
37
|
+
</data>
|
38
|
+
<data type="other">
|
39
|
+
<checksum type="sha256">6bf9672d0862e8ef8b8ff05a2fd0208a922b1f5978e6589d87944c88259cb670</checksum>
|
40
|
+
<open-checksum type="sha256">e0ed5e0054194df036cf09c1a911e15bf2a4e7f26f2a788b6f47d53e80717ccc</open-checksum>
|
41
|
+
<location href="repodata/6bf96-other.xml.gz"/>
|
42
|
+
<timestamp>1667508211</timestamp>
|
43
|
+
<size>123</size>
|
44
|
+
<open-size>121</open-size>
|
45
|
+
</data>
|
46
|
+
<data type="filelists_db">
|
47
|
+
<checksum type="sha256">01a3b489a465bcac22a43492163df43451dc6ce47d27f66de289756b91635523</checksum>
|
48
|
+
<open-checksum type="sha256">c4211f57bdcbb142c9f93a6d32401539f775eb6a670ab7a423e13f435ce94689</open-checksum>
|
49
|
+
<location href="repodata/01a3b-filelists.sqlite.bz2"/>
|
50
|
+
<timestamp>1667508211</timestamp>
|
51
|
+
<database_version>10</database_version>
|
52
|
+
<size>586</size>
|
53
|
+
<open-size>7168</open-size>
|
54
|
+
</data>
|
55
|
+
</repomd>
|
@@ -24,7 +24,7 @@ describe Chef::Resource::ChocolateyPackage, :windows_only, :choco_installed do
|
|
24
24
|
let(:package_name) { "test-A" }
|
25
25
|
let(:package_source) { File.join(CHEF_SPEC_ASSETS, "chocolatey_feed") }
|
26
26
|
let(:package_list) do
|
27
|
-
if
|
27
|
+
if provider.query_command == "list"
|
28
28
|
# using result of query_command because that indicates which "search" command to use
|
29
29
|
# which coincides with the package list output
|
30
30
|
proc { shell_out!("choco search -lo #{Array(package_name).join(" ")}").stdout.chomp }
|
@@ -63,7 +63,7 @@ describe Chef::Resource::ChocolateyPackage, :windows_only, :choco_installed do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
after(:each) do
|
66
|
-
|
66
|
+
provider.instance_variable_set(:@get_choco_version, nil)
|
67
67
|
end
|
68
68
|
|
69
69
|
context "installing a package" do
|
@@ -25,24 +25,33 @@ describe Chef::Resource::Group, :requires_root_or_running_windows do
|
|
25
25
|
|
26
26
|
def group_should_exist(group)
|
27
27
|
case ohai[:os]
|
28
|
-
when "
|
29
|
-
expect {
|
30
|
-
expect(group).to eq(Etc.getgrnam(group).name)
|
28
|
+
when "freebsd"
|
29
|
+
expect(shell_out("pw groupshow -n #{group}").exitstatus).to eq(0)
|
31
30
|
when "windows"
|
32
31
|
expect { Chef::Util::Windows::NetGroup.new(group).local_get_members }.not_to raise_error
|
32
|
+
else
|
33
|
+
expect { Etc.getgrnam(group) }.not_to raise_error
|
34
|
+
expect(group).to eq(Etc.getgrnam(group).name)
|
33
35
|
end
|
34
36
|
end
|
35
37
|
|
36
38
|
def user_exist_in_group?(user)
|
37
39
|
case ohai[:platform_family]
|
38
|
-
when "
|
39
|
-
|
40
|
-
|
40
|
+
when "freebsd"
|
41
|
+
cmd = Mixlib::ShellOut.new("getent group #{group_name} #{user}").run_command.stdout
|
42
|
+
if cmd.include? user
|
43
|
+
true
|
44
|
+
else
|
45
|
+
false
|
46
|
+
end
|
41
47
|
when "mac_os_x"
|
42
48
|
membership_info = shell_out("dscl . -read /Groups/#{group_name}").stdout
|
43
49
|
members = membership_info.split(" ")
|
44
50
|
members.shift # Get rid of GroupMembership: string
|
45
51
|
members.include?(user)
|
52
|
+
when "windows"
|
53
|
+
user_sid = sid_string_from_user(user)
|
54
|
+
user_sid.nil? ? false : Chef::Util::Windows::NetGroup.new(group_name).local_get_members.include?(user_sid)
|
46
55
|
else
|
47
56
|
# TODO For some reason our temporary AIX 7.2 system does not correctly report group membership immediately after changes have been made.
|
48
57
|
# Adding a 2 second delay for this platform is enough to get correct results.
|
@@ -54,10 +63,12 @@ describe Chef::Resource::Group, :requires_root_or_running_windows do
|
|
54
63
|
|
55
64
|
def group_should_not_exist(group)
|
56
65
|
case ohai[:os]
|
57
|
-
when "
|
58
|
-
expect
|
66
|
+
when "freebsd"
|
67
|
+
expect(shell_out("pw groupshow -n #{group}").exitstatus).to eq(65)
|
59
68
|
when "windows"
|
60
69
|
expect { Chef::Util::Windows::NetGroup.new(group).local_get_members }.to raise_error(ArgumentError, /The group name could not be found./)
|
70
|
+
else
|
71
|
+
expect { Etc.getgrnam(group) }.to raise_error(ArgumentError, "can't find group for #{group}")
|
61
72
|
end
|
62
73
|
end
|
63
74
|
|
@@ -158,7 +169,7 @@ describe Chef::Resource::Group, :requires_root_or_running_windows do
|
|
158
169
|
end
|
159
170
|
|
160
171
|
# dscl doesn't perform any error checking and will let you add users that don't exist.
|
161
|
-
describe "when no users exist", :not_supported_on_macos do
|
172
|
+
describe "when no users exist", :not_supported_on_macos, :not_supported_on_freebsd_gte_12_3 do
|
162
173
|
describe "when append is not set" do
|
163
174
|
# excluded_members can only be used when append is set. It is ignored otherwise.
|
164
175
|
let(:excluded_members) { [] }
|
@@ -199,13 +210,14 @@ describe Chef::Resource::Group, :requires_root_or_running_windows do
|
|
199
210
|
end
|
200
211
|
end
|
201
212
|
|
202
|
-
describe "when append is not set" do
|
213
|
+
describe "when append is not set", :not_supported_on_freebsd_gte_12_3 do
|
203
214
|
it "should set the group to to contain given members" do
|
204
215
|
group_resource.run_action(tested_action)
|
205
216
|
|
206
217
|
included_members.each do |member|
|
207
218
|
expect(user_exist_in_group?(member)).to eq(true)
|
208
219
|
end
|
220
|
+
|
209
221
|
(spec_members - included_members).each do |member|
|
210
222
|
expect(user_exist_in_group?(member)).to eq(false)
|
211
223
|
end
|
@@ -223,14 +235,16 @@ describe Chef::Resource::Group, :requires_root_or_running_windows do
|
|
223
235
|
included_members.each do |member|
|
224
236
|
expect(user_exist_in_group?(member)).to eq(true)
|
225
237
|
end
|
226
|
-
|
227
|
-
|
238
|
+
unless freebsd?
|
239
|
+
(spec_members - included_members).each do |member|
|
240
|
+
expect(user_exist_in_group?(member)).to eq(false)
|
241
|
+
end
|
228
242
|
end
|
229
243
|
end
|
230
244
|
end
|
231
245
|
end
|
232
246
|
|
233
|
-
describe "when append is set" do
|
247
|
+
describe "when append is set", :not_supported_on_freebsd_gte_12_3 do
|
234
248
|
before(:each) do
|
235
249
|
group_resource.append(true)
|
236
250
|
end
|
@@ -241,6 +255,7 @@ describe Chef::Resource::Group, :requires_root_or_running_windows do
|
|
241
255
|
included_members.each do |member|
|
242
256
|
expect(user_exist_in_group?(member)).to eq(true)
|
243
257
|
end
|
258
|
+
|
244
259
|
excluded_members.each do |member|
|
245
260
|
expect(user_exist_in_group?(member)).to eq(false)
|
246
261
|
end
|
@@ -257,6 +272,7 @@ describe Chef::Resource::Group, :requires_root_or_running_windows do
|
|
257
272
|
included_members.each do |member|
|
258
273
|
expect(user_exist_in_group?(member)).to eq(true)
|
259
274
|
end
|
275
|
+
|
260
276
|
excluded_members.each do |member|
|
261
277
|
expect(user_exist_in_group?(member)).to eq(false)
|
262
278
|
end
|
@@ -336,7 +352,7 @@ describe Chef::Resource::Group, :requires_root_or_running_windows do
|
|
336
352
|
expect(group_resource.append).to eq(false)
|
337
353
|
end
|
338
354
|
|
339
|
-
describe "group create action" do
|
355
|
+
describe "group create action", :not_supported_on_freebsd_gte_12_3, :not_supported_on_macos, :not_supported_on_aix do
|
340
356
|
after(:each) do
|
341
357
|
group_resource.run_action(:remove)
|
342
358
|
group_should_not_exist(group_name)
|
@@ -393,7 +409,7 @@ describe Chef::Resource::Group, :requires_root_or_running_windows do
|
|
393
409
|
end
|
394
410
|
|
395
411
|
describe "group remove action" do
|
396
|
-
describe "when there is a group" do
|
412
|
+
describe "when there is a group", :not_supported_on_freebsd_gte_12_3, :not_supported_on_macos, :not_supported_on_aix do
|
397
413
|
before do
|
398
414
|
group_resource.run_action(:create)
|
399
415
|
group_should_exist(group_name)
|
@@ -425,7 +441,7 @@ describe Chef::Resource::Group, :requires_root_or_running_windows do
|
|
425
441
|
end
|
426
442
|
end
|
427
443
|
|
428
|
-
describe "when there is a group" do
|
444
|
+
describe "when there is a group", :not_supported_on_macos, :not_supported_on_aix do
|
429
445
|
it_behaves_like "correct group management"
|
430
446
|
end
|
431
447
|
|
@@ -458,12 +474,16 @@ describe Chef::Resource::Group, :requires_root_or_running_windows do
|
|
458
474
|
end
|
459
475
|
|
460
476
|
it "does not raise an error on manage" do
|
461
|
-
|
477
|
+
if freebsd?
|
478
|
+
allow(shell_out).to receive("pw user show").and_return(double("User"))
|
479
|
+
else
|
480
|
+
allow(Etc).to receive(:getpwnam).and_return(double("User"))
|
481
|
+
end
|
462
482
|
expect { group_resource.run_action(:manage) }.not_to raise_error
|
463
483
|
end
|
464
484
|
end
|
465
485
|
|
466
|
-
describe "when there is a group" do
|
486
|
+
describe "when there is a group", :not_supported_on_macos, :not_supported_on_aix do
|
467
487
|
it_behaves_like "correct group management"
|
468
488
|
end
|
469
489
|
|
@@ -57,6 +57,12 @@ describe Chef::Resource::YumPackage, :requires_root, external: exclude_test, not
|
|
57
57
|
baseurl=file://#{CHEF_SPEC_ASSETS}/yumrepo
|
58
58
|
enable=1
|
59
59
|
gpgcheck=0
|
60
|
+
[chef-yum-empty]
|
61
|
+
name=Chef DNF spec empty repo
|
62
|
+
baseurl=file://#{CHEF_SPEC_ASSETS}/yumrepo-empty
|
63
|
+
enable=1
|
64
|
+
gpgcheck=0
|
65
|
+
|
60
66
|
EOF
|
61
67
|
end
|
62
68
|
# ensure we don't have any stray chef_rpms installed
|
@@ -1095,6 +1101,16 @@ describe Chef::Resource::YumPackage, :requires_root, external: exclude_test, not
|
|
1095
1101
|
end.should_not_be_updated
|
1096
1102
|
end
|
1097
1103
|
|
1104
|
+
it "should work to disable a repo" do
|
1105
|
+
flush_cache
|
1106
|
+
expect {
|
1107
|
+
yum_package "chef_rpm" do
|
1108
|
+
options "--disablerepo=chef-yum-localtesting --enablerepo=chef-yum-empty"
|
1109
|
+
action :install
|
1110
|
+
end
|
1111
|
+
}.to raise_error(Chef::Exceptions::Package, /No candidate version available/)
|
1112
|
+
end
|
1113
|
+
|
1098
1114
|
it "when an idempotent install action is run, does not leave repos disabled" do
|
1099
1115
|
flush_cache
|
1100
1116
|
# this is a bit tricky -- we need this action to be idempotent, so that it doesn't recycle any
|
@@ -395,6 +395,9 @@ describe "Chef::Win32::Registry", :windows_only do
|
|
395
395
|
expect { @registry.get_subkeys("JKLM\\Software\\Root") }.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
|
396
396
|
end
|
397
397
|
it "returns the array of subkeys for a given key" do
|
398
|
+
::Win32::Registry.define_method :export_string do |str, enc = (Encoding.default_internal || "utf-8")|
|
399
|
+
str.encode(enc)
|
400
|
+
end
|
398
401
|
subkeys = @registry.get_subkeys("HKCU\\Software\\Root")
|
399
402
|
reg_subkeys = []
|
400
403
|
::Win32::Registry::HKEY_CURRENT_USER.open("Software\\Root", Win32::Registry::KEY_ALL_ACCESS) do |reg|
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "chef-client fips" do
|
4
|
+
def enable_fips
|
5
|
+
OpenSSL.fips_mode = true
|
6
|
+
end
|
7
|
+
|
8
|
+
# All tests assume fips mode is off at present
|
9
|
+
after { OpenSSL.fips_mode = false }
|
10
|
+
|
11
|
+
# For non-FIPS OSes/builds of Ruby, enabling FIPS should error
|
12
|
+
example "Error enabling fips_mode if FIPS not linked", fips_mode: false do
|
13
|
+
expect { enable_fips }.to raise_error(OpenSSL::OpenSSLError)
|
14
|
+
end
|
15
|
+
|
16
|
+
example "Do not error on MD5 if not fips_mode", fips_mode: false do
|
17
|
+
expect { OpenSSL::Digest.new("MD5", "test string for digesting") }.not_to raise_error
|
18
|
+
end
|
19
|
+
|
20
|
+
# For FIPS OSes/builds of Ruby, enabling FIPS should not error
|
21
|
+
example "Do not error enabling fips_mode if FIPS linked", fips_mode: true do
|
22
|
+
expect { enable_fips }.not_to raise_error
|
23
|
+
end
|
24
|
+
|
25
|
+
example "Error on MD5 if fips_mode", fips_mode: true do
|
26
|
+
enable_fips
|
27
|
+
expect { OpenSSL::Digest.new("MD5", "test string for digesting") }.to raise_error(OpenSSL::Digest::DigestError)
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "openssl checks" do
|
4
|
+
let(:openssl_version_default) do
|
5
|
+
if windows? || aix?
|
6
|
+
"1.0.2zi"
|
7
|
+
elsif macos?
|
8
|
+
"1.1.1m"
|
9
|
+
else
|
10
|
+
"3.0.9"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
%w{version library_version}.each do |method|
|
15
|
+
# macOS just picks up its own for some reason, maybe it circumvents a build step
|
16
|
+
example "check #{method}", openssl_version_check: true, not_supported_on_macos: true do
|
17
|
+
expect(OpenSSL.const_get("OPENSSL_#{method.upcase}")).to match(openssl_version_default), "OpenSSL doesn't match omnibus_overrides.rb"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -138,6 +138,9 @@ RSpec.configure do |config|
|
|
138
138
|
|
139
139
|
config.filter_run_excluding skip_buildkite: true if ENV["BUILDKITE"]
|
140
140
|
|
141
|
+
config.filter_run_excluding fips_mode: !fips_mode_build?
|
142
|
+
|
143
|
+
config.filter_run_excluding not_supported_on_freebsd_gte_12_3: true if freebsd_gte_12_3?
|
141
144
|
config.filter_run_excluding windows_only: true unless windows?
|
142
145
|
config.filter_run_excluding not_supported_on_windows: true if windows?
|
143
146
|
config.filter_run_excluding not_supported_on_macos: true if macos?
|
@@ -163,6 +166,8 @@ RSpec.configure do |config|
|
|
163
166
|
config.filter_run_excluding linux_only: true unless linux?
|
164
167
|
config.filter_run_excluding aix_only: true unless aix?
|
165
168
|
config.filter_run_excluding suse_only: true unless suse?
|
169
|
+
# These aren't valid on verify pipeline because the docker container brings its own OpenSSL
|
170
|
+
config.filter_run_excluding openssl_version_check: true if ENV["BUILDKITE_PIPELINE_SLUG"] =~ /verify/
|
166
171
|
config.filter_run_excluding opensuse: true unless opensuse?
|
167
172
|
config.filter_run_excluding debian_family_only: true unless debian_family?
|
168
173
|
config.filter_run_excluding supports_cloexec: true unless supports_cloexec?
|
@@ -127,6 +127,10 @@ def freebsd?
|
|
127
127
|
RUBY_PLATFORM.include?("freebsd")
|
128
128
|
end
|
129
129
|
|
130
|
+
def freebsd_gte_12_3?
|
131
|
+
RUBY_PLATFORM.include?("freebsd") && !!(ohai[:platform_version].to_f >= 12.3)
|
132
|
+
end
|
133
|
+
|
130
134
|
def intel_64bit?
|
131
135
|
!!(ohai[:kernel][:machine] == "x86_64")
|
132
136
|
end
|
@@ -219,6 +223,10 @@ def aes_256_gcm?
|
|
219
223
|
OpenSSL::Cipher.ciphers.include?("aes-256-gcm")
|
220
224
|
end
|
221
225
|
|
226
|
+
def fips_mode_build?
|
227
|
+
OpenSSL::OPENSSL_FIPS
|
228
|
+
end
|
229
|
+
|
222
230
|
def fips?
|
223
231
|
ENV["CHEF_FIPS"] == "1"
|
224
232
|
end
|
data/spec/unit/client_spec.rb
CHANGED
@@ -308,25 +308,6 @@ describe Chef::Client do
|
|
308
308
|
end
|
309
309
|
end
|
310
310
|
|
311
|
-
describe "eol release warning" do
|
312
|
-
it "warns when running an EOL release" do
|
313
|
-
stub_const("Chef::VERSION", 15)
|
314
|
-
# added a call to client because Time.now gets invoked multiple times during instantiation. Don't mock Time until after client initialized
|
315
|
-
client
|
316
|
-
expect(Time).to receive(:now).and_return(Time.new(2024, 12, 1, 5))
|
317
|
-
allow(client).to receive(:eol_override).and_return(false)
|
318
|
-
expect(logger).to receive(:warn).with("This release of Chef Infra Client became end of life (EOL) on Nov 30, 2024. Please update to a supported release to receive new features, bug fixes, and security updates.")
|
319
|
-
client.warn_if_eol
|
320
|
-
end
|
321
|
-
|
322
|
-
it "does not warn when running an non-EOL release" do
|
323
|
-
stub_const("Chef::VERSION", 15)
|
324
|
-
allow(Time).to receive(:now).and_return(Time.new(2021, 4, 30))
|
325
|
-
expect(logger).to_not receive(:warn).with(/became end of life/)
|
326
|
-
client.warn_if_eol
|
327
|
-
end
|
328
|
-
end
|
329
|
-
|
330
311
|
describe "authentication protocol selection" do
|
331
312
|
context "when FIPS is disabled" do
|
332
313
|
before do
|
@@ -92,7 +92,7 @@ describe Chef::Mixin::OpenSSLHelper do
|
|
92
92
|
|
93
93
|
context "When the dhparam.pem file does exist, and does contain a vaild dhparam key" do
|
94
94
|
it "returns true" do
|
95
|
-
@dhparam_file.puts(::OpenSSL::PKey::DH.new(
|
95
|
+
@dhparam_file.puts(::OpenSSL::PKey::DH.new(1024).to_pem)
|
96
96
|
@dhparam_file.close
|
97
97
|
expect(instance.dhparam_pem_valid?(@dhparam_file.path)).to be_truthy
|
98
98
|
end
|
@@ -769,6 +769,40 @@ describe Chef::Provider::Cron do
|
|
769
769
|
end
|
770
770
|
end
|
771
771
|
|
772
|
+
context "when integers are provided to the resource to express time values" do
|
773
|
+
it "should not report any difference" do
|
774
|
+
@new_resource.minute(1)
|
775
|
+
@new_resource.hour(1)
|
776
|
+
@new_resource.day(1)
|
777
|
+
@new_resource.month(1)
|
778
|
+
@new_resource.weekday(1)
|
779
|
+
allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB)
|
780
|
+
# Chef Name: cronhole some stuff
|
781
|
+
1 1 1 1 1 /bin/true
|
782
|
+
CRONTAB
|
783
|
+
|
784
|
+
@provider.run_action(:create)
|
785
|
+
expect(@new_resource).not_to be_updated_by_last_action
|
786
|
+
end
|
787
|
+
end
|
788
|
+
|
789
|
+
context "when strings are provided to the resource to express time values" do
|
790
|
+
it "should not report any difference" do
|
791
|
+
@new_resource.minute("1")
|
792
|
+
@new_resource.hour("1")
|
793
|
+
@new_resource.day("1")
|
794
|
+
@new_resource.month("1")
|
795
|
+
@new_resource.weekday("1")
|
796
|
+
allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB)
|
797
|
+
# Chef Name: cronhole some stuff
|
798
|
+
1 1 1 1 1 /bin/true
|
799
|
+
CRONTAB
|
800
|
+
|
801
|
+
@provider.run_action(:create)
|
802
|
+
expect(@new_resource).not_to be_updated_by_last_action
|
803
|
+
end
|
804
|
+
end
|
805
|
+
|
772
806
|
context "when environment variable is used" do
|
773
807
|
before :each do
|
774
808
|
@provider.cron_exists = true
|
@@ -47,10 +47,11 @@ describe Chef::Provider::Package::Chocolatey, :windows_only do
|
|
47
47
|
allow(provider).to receive(:choco_exe).and_return(choco_exe)
|
48
48
|
local_list_obj = double(stdout: local_list_stdout)
|
49
49
|
allow(provider).to receive(:shell_out_compacted!).with(choco_exe, "list", "-l", "-r", { returns: [0, 2], timeout: timeout }).and_return(local_list_obj)
|
50
|
+
allow(provider).to receive(:powershell_exec!).with("#{choco_exe} --version").and_return(double(result: "2.1.0"))
|
50
51
|
end
|
51
52
|
|
52
53
|
after(:each) do
|
53
|
-
|
54
|
+
provider.instance_variable_set(:@get_choco_version, nil)
|
54
55
|
end
|
55
56
|
|
56
57
|
def allow_remote_list(package_names, args = nil)
|
@@ -65,9 +66,9 @@ describe Chef::Provider::Package::Chocolatey, :windows_only do
|
|
65
66
|
remote_list_obj = double(stdout: remote_list_stdout)
|
66
67
|
package_names.each do |pkg|
|
67
68
|
if args
|
68
|
-
allow(provider).to receive(:shell_out_compacted!).with(choco_exe,
|
69
|
+
allow(provider).to receive(:shell_out_compacted!).with(choco_exe, provider.query_command, "-r", pkg, *args, { returns: [0, 2], timeout: timeout }).and_return(remote_list_obj)
|
69
70
|
else
|
70
|
-
allow(provider).to receive(:shell_out_compacted!).with(choco_exe,
|
71
|
+
allow(provider).to receive(:shell_out_compacted!).with(choco_exe, provider.query_command, "-r", pkg, { returns: [0, 2], timeout: timeout }).and_return(remote_list_obj)
|
71
72
|
end
|
72
73
|
end
|
73
74
|
end
|
@@ -84,12 +85,12 @@ describe Chef::Provider::Package::Chocolatey, :windows_only do
|
|
84
85
|
|
85
86
|
describe "choco searches change with the version" do
|
86
87
|
it "Choco V1 uses List" do
|
87
|
-
allow(
|
88
|
+
allow(provider).to receive(:powershell_exec!).with("#{choco_exe} --version").and_return(double(result: "1.4.0"))
|
88
89
|
expect(provider.query_command).to eql("list")
|
89
90
|
end
|
90
91
|
|
91
92
|
it "Choco V2 uses Search" do
|
92
|
-
allow(
|
93
|
+
allow(provider).to receive(:powershell_exec!).with("#{choco_exe} --version").and_return(double(result: "2.1.0"))
|
93
94
|
expect(provider.query_command).to eql("search")
|
94
95
|
end
|
95
96
|
end
|
@@ -166,7 +167,7 @@ describe Chef::Provider::Package::Chocolatey, :windows_only do
|
|
166
167
|
new_resource.package_name("package-does-not-exist")
|
167
168
|
new_resource.returns([0])
|
168
169
|
allow(provider).to receive(:shell_out_compacted!)
|
169
|
-
.with(choco_exe,
|
170
|
+
.with(choco_exe, provider.query_command, "-r", new_resource.package_name.first, { returns: new_resource.returns, timeout: timeout })
|
170
171
|
.and_raise(Mixlib::ShellOut::ShellCommandFailed, "Expected process to exit with [0], but received '2'")
|
171
172
|
expect { provider.send(:available_packages) }.to raise_error(Mixlib::ShellOut::ShellCommandFailed, "Expected process to exit with [0], but received '2'")
|
172
173
|
end
|
data/spec/unit/resource_spec.rb
CHANGED
@@ -958,14 +958,7 @@ describe Chef::Resource do
|
|
958
958
|
klz.provides :energy, platform: %w{autobots decepticons}
|
959
959
|
end
|
960
960
|
|
961
|
-
it "adds mappings for all platforms", ruby: "
|
962
|
-
expect(Chef.resource_handler_map).to receive(:set).with(
|
963
|
-
:tape_deck, Chef::Resource::Klz, {}
|
964
|
-
)
|
965
|
-
klz.provides :tape_deck
|
966
|
-
end
|
967
|
-
|
968
|
-
it "adds mappings for all platforms", ruby: ">= 2.7" do
|
961
|
+
it "adds mappings for all platforms", ruby: ">= 3.0" do
|
969
962
|
expect(Chef.resource_handler_map).to receive(:set).with(
|
970
963
|
:tape_deck, Chef::Resource::Klz
|
971
964
|
)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 17.10.
|
4
|
+
version: 17.10.163
|
5
5
|
platform: universal-mingw32
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef-config
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 17.10.
|
19
|
+
version: 17.10.163
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 17.10.
|
26
|
+
version: 17.10.163
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: chef-utils
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 17.10.
|
33
|
+
version: 17.10.163
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 17.10.
|
40
|
+
version: 17.10.163
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: train-core
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -45,6 +45,9 @@ dependencies:
|
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '3.10'
|
48
|
+
- - "<"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 3.12.5
|
48
51
|
type: :runtime
|
49
52
|
prerelease: false
|
50
53
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -52,6 +55,9 @@ dependencies:
|
|
52
55
|
- - "~>"
|
53
56
|
- !ruby/object:Gem::Version
|
54
57
|
version: '3.10'
|
58
|
+
- - "<"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 3.12.5
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
name: train-winrm
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -192,28 +198,28 @@ dependencies:
|
|
192
198
|
requirements:
|
193
199
|
- - "~>"
|
194
200
|
- !ruby/object:Gem::Version
|
195
|
-
version: '17.
|
201
|
+
version: '17.9'
|
196
202
|
type: :runtime
|
197
203
|
prerelease: false
|
198
204
|
version_requirements: !ruby/object:Gem::Requirement
|
199
205
|
requirements:
|
200
206
|
- - "~>"
|
201
207
|
- !ruby/object:Gem::Version
|
202
|
-
version: '17.
|
208
|
+
version: '17.9'
|
203
209
|
- !ruby/object:Gem::Dependency
|
204
210
|
name: inspec-core
|
205
211
|
requirement: !ruby/object:Gem::Requirement
|
206
212
|
requirements:
|
207
213
|
- - "~>"
|
208
214
|
- !ruby/object:Gem::Version
|
209
|
-
version: 5.22.
|
215
|
+
version: 5.22.40
|
210
216
|
type: :runtime
|
211
217
|
prerelease: false
|
212
218
|
version_requirements: !ruby/object:Gem::Requirement
|
213
219
|
requirements:
|
214
220
|
- - "~>"
|
215
221
|
- !ruby/object:Gem::Version
|
216
|
-
version: 5.22.
|
222
|
+
version: 5.22.40
|
217
223
|
- !ruby/object:Gem::Dependency
|
218
224
|
name: ffi
|
219
225
|
requirement: !ruby/object:Gem::Requirement
|
@@ -447,19 +453,19 @@ dependencies:
|
|
447
453
|
- !ruby/object:Gem::Version
|
448
454
|
version: 0.3.4
|
449
455
|
- !ruby/object:Gem::Dependency
|
450
|
-
name:
|
456
|
+
name: proxifier2
|
451
457
|
requirement: !ruby/object:Gem::Requirement
|
452
458
|
requirements:
|
453
459
|
- - "~>"
|
454
460
|
- !ruby/object:Gem::Version
|
455
|
-
version: '1.
|
461
|
+
version: '1.1'
|
456
462
|
type: :runtime
|
457
463
|
prerelease: false
|
458
464
|
version_requirements: !ruby/object:Gem::Requirement
|
459
465
|
requirements:
|
460
466
|
- - "~>"
|
461
467
|
- !ruby/object:Gem::Version
|
462
|
-
version: '1.
|
468
|
+
version: '1.1'
|
463
469
|
- !ruby/object:Gem::Dependency
|
464
470
|
name: aws-sdk-s3
|
465
471
|
requirement: !ruby/object:Gem::Requirement
|
@@ -494,14 +500,14 @@ dependencies:
|
|
494
500
|
requirements:
|
495
501
|
- - "~>"
|
496
502
|
- !ruby/object:Gem::Version
|
497
|
-
version:
|
503
|
+
version: 0.18.2
|
498
504
|
type: :runtime
|
499
505
|
prerelease: false
|
500
506
|
version_requirements: !ruby/object:Gem::Requirement
|
501
507
|
requirements:
|
502
508
|
- - "~>"
|
503
509
|
- !ruby/object:Gem::Version
|
504
|
-
version:
|
510
|
+
version: 0.18.2
|
505
511
|
- !ruby/object:Gem::Dependency
|
506
512
|
name: win32-api
|
507
513
|
requirement: !ruby/object:Gem::Requirement
|
@@ -674,14 +680,14 @@ dependencies:
|
|
674
680
|
requirements:
|
675
681
|
- - "~>"
|
676
682
|
- !ruby/object:Gem::Version
|
677
|
-
version: 1.0
|
683
|
+
version: 18.1.0
|
678
684
|
type: :runtime
|
679
685
|
prerelease: false
|
680
686
|
version_requirements: !ruby/object:Gem::Requirement
|
681
687
|
requirements:
|
682
688
|
- - "~>"
|
683
689
|
- !ruby/object:Gem::Version
|
684
|
-
version: 1.0
|
690
|
+
version: 18.1.0
|
685
691
|
description: A systems integration framework, built to bring the benefits of configuration
|
686
692
|
management to your entire infrastructure.
|
687
693
|
email: adam@chef.io
|
@@ -2466,6 +2472,13 @@ files:
|
|
2466
2472
|
- spec/functional/assets/mytest-1.0-1.noarch.rpm
|
2467
2473
|
- spec/functional/assets/mytest-2.0-1.noarch.rpm
|
2468
2474
|
- spec/functional/assets/testchefsubsys
|
2475
|
+
- spec/functional/assets/yumrepo-empty/repodata/01a3b-filelists.sqlite.bz2
|
2476
|
+
- spec/functional/assets/yumrepo-empty/repodata/401dc-filelists.xml.gz
|
2477
|
+
- spec/functional/assets/yumrepo-empty/repodata/5dc1e-primary.sqlite.bz2
|
2478
|
+
- spec/functional/assets/yumrepo-empty/repodata/6bf96-other.xml.gz
|
2479
|
+
- spec/functional/assets/yumrepo-empty/repodata/7c365-other.sqlite.bz2
|
2480
|
+
- spec/functional/assets/yumrepo-empty/repodata/dabe2-primary.xml.gz
|
2481
|
+
- spec/functional/assets/yumrepo-empty/repodata/repomd.xml
|
2469
2482
|
- spec/functional/assets/yumrepo/chef_rpm-1.10-1.aarch64.rpm
|
2470
2483
|
- spec/functional/assets/yumrepo/chef_rpm-1.10-1.i686.rpm
|
2471
2484
|
- spec/functional/assets/yumrepo/chef_rpm-1.10-1.ppc64.rpm
|
@@ -2584,7 +2597,9 @@ files:
|
|
2584
2597
|
- spec/functional/win32/versions_spec.rb
|
2585
2598
|
- spec/integration/client/client_spec.rb
|
2586
2599
|
- spec/integration/client/exit_code_spec.rb
|
2600
|
+
- spec/integration/client/fips_spec.rb
|
2587
2601
|
- spec/integration/client/ipv6_spec.rb
|
2602
|
+
- spec/integration/client/open_ssl_spec.rb
|
2588
2603
|
- spec/integration/compliance/compliance_spec.rb
|
2589
2604
|
- spec/integration/ohai/ohai_spec.rb
|
2590
2605
|
- spec/integration/recipes/accumulator_spec.rb
|
@@ -3180,7 +3195,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
3180
3195
|
requirements:
|
3181
3196
|
- - ">="
|
3182
3197
|
- !ruby/object:Gem::Version
|
3183
|
-
version:
|
3198
|
+
version: 3.0.0
|
3184
3199
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
3185
3200
|
requirements:
|
3186
3201
|
- - ">="
|