chef 17.10.0-universal-mingw32 → 17.10.95-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 +2 -2
- data/Rakefile +2 -2
- data/chef-universal-mingw32.gemspec +2 -2
- data/chef.gemspec +5 -5
- data/lib/chef/client.rb +17 -2
- data/lib/chef/compliance/input_collection.rb +1 -1
- data/lib/chef/compliance/profile_collection.rb +1 -1
- data/lib/chef/compliance/waiver_collection.rb +1 -1
- data/lib/chef/dsl/secret.rb +113 -5
- data/lib/chef/mixin/checksum.rb +6 -0
- data/lib/chef/mixin/properties.rb +6 -0
- data/lib/chef/node/attribute.rb +20 -3
- data/lib/chef/node/mixin/deep_merge_cache.rb +4 -4
- data/lib/chef/provider/file.rb +2 -2
- data/lib/chef/provider/package/chocolatey.rb +18 -1
- data/lib/chef/provider/package/powershell.rb +1 -1
- data/lib/chef/provider/package/windows.rb +1 -1
- data/lib/chef/provider/user.rb +5 -1
- data/lib/chef/resource/chef_client_config.rb +5 -0
- data/lib/chef/resource/locale.rb +5 -2
- data/lib/chef/resource/macos_userdefaults.rb +9 -5
- data/lib/chef/resource/rhsm_register.rb +19 -0
- data/lib/chef/resource/support/client.erb +1 -2
- data/lib/chef/resource/windows_certificate.rb +54 -43
- data/lib/chef/resource/windows_pagefile.rb +28 -21
- data/lib/chef/resource/windows_user_privilege.rb +36 -26
- data/lib/chef/resource.rb +2 -1
- data/lib/chef/run_context.rb +16 -0
- data/lib/chef/secret_fetcher/hashi_vault.rb +1 -1
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/version.rb +2 -1
- data/spec/data/trusted_certs/example.crt +29 -20
- data/spec/data/trusted_certs/example_no_cn.crt +30 -34
- data/spec/data/trusted_certs/opscode.pem +33 -54
- data/spec/functional/resource/chocolatey_package_spec.rb +32 -20
- data/spec/functional/resource/macos_userdefaults_spec.rb +4 -4
- data/spec/functional/resource/windows_certificate_spec.rb +41 -13
- data/spec/functional/resource/windows_font_spec.rb +1 -1
- data/spec/functional/resource/windows_pagefile_spec.rb +31 -4
- data/spec/functional/resource/yum_package_spec.rb +1 -1
- data/spec/functional/shell_spec.rb +6 -0
- data/spec/unit/client_spec.rb +6 -3
- data/spec/unit/compliance/reporter/chef_server_automate_spec.rb +1 -1
- data/spec/unit/daemon_spec.rb +1 -5
- data/spec/unit/dsl/secret_spec.rb +127 -23
- data/spec/unit/mixin/checksum_spec.rb +28 -0
- data/spec/unit/provider/package/chocolatey_spec.rb +19 -3
- data/spec/unit/provider/package/rubygems_spec.rb +1 -1
- data/spec/unit/provider/user/linux_spec.rb +55 -0
- data/spec/unit/resource/chef_client_config_spec.rb +8 -0
- data/spec/unit/resource/macos_user_defaults_spec.rb +4 -4
- data/spec/unit/resource_spec.rb +22 -1
- data/spec/unit/run_context_spec.rb +16 -0
- metadata +48 -54
- /data/spec/functional/assets/chocolatey_feed/{test-A.1.0.nupkg → test-A.1.0.0.nupkg} +0 -0
- /data/spec/functional/assets/chocolatey_feed/{test-A.1.5.nupkg → test-A.1.5.0.nupkg} +0 -0
- /data/spec/functional/assets/chocolatey_feed/{test-A.2.0.nupkg → test-A.2.0.0.nupkg} +0 -0
- /data/spec/functional/assets/chocolatey_feed/{test-B.1.0.nupkg → test-B.1.0.0.nupkg} +0 -0
- /data/spec/functional/assets/yumrepo/repodata/{4632d67cb92636e7575d911c24f0e04d3505a944e97c483abe0c3e73a7c62d33-filelists.sqlite.bz2 → 01a3b-filelists.sqlite.bz2} +0 -0
- /data/spec/functional/assets/yumrepo/repodata/{bdb4f5f1492a3b9532f22c43110a81500dd744f23da0aec5c33b2a41317c737d-filelists.xml.gz → 401dc-filelists.xml.gz} +0 -0
- /data/spec/functional/assets/yumrepo/repodata/{a845d418f919d2115ab95a56b2c76f6825ad0d0bede49181a55c04f58995d057-primary.sqlite.bz2 → 5dc1e-primary.sqlite.bz2} +0 -0
- /data/spec/functional/assets/yumrepo/repodata/{74599b793e54d877323837d2d81a1c3c594c44e4335f9528234bb490f7b9b439-other.xml.gz → 6bf96-other.xml.gz} +0 -0
- /data/spec/functional/assets/yumrepo/repodata/{af9b7cf9ef23bd7b43068d74a460f3b5d06753d638e58e4a0c9edc35bfb9cdc4-other.sqlite.bz2 → 7c365-other.sqlite.bz2} +0 -0
- /data/spec/functional/assets/yumrepo/repodata/{c10d1d34ce99e02f12ec96ef68360543ab1bb7c3cb81a4a2bf78df7d8597e9df-primary.xml.gz → dabe2-primary.xml.gz} +0 -0
@@ -17,11 +17,14 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
require "spec_helper"
|
20
|
+
require "chef/exceptions"
|
20
21
|
require "chef/dsl/secret"
|
21
22
|
require "chef/secret_fetcher/base"
|
23
|
+
|
22
24
|
class SecretDSLTester
|
23
25
|
include Chef::DSL::Secret
|
24
|
-
|
26
|
+
|
27
|
+
# Because DSL is invoked in the context of a recipe or attribute file
|
25
28
|
# we expect run_context to always be available when SecretFetcher::Base
|
26
29
|
# requests it - making it safe to mock here
|
27
30
|
def run_context
|
@@ -37,35 +40,136 @@ end
|
|
37
40
|
|
38
41
|
describe Chef::DSL::Secret do
|
39
42
|
let(:dsl) { SecretDSLTester.new }
|
40
|
-
|
41
|
-
|
43
|
+
let(:run_context) { Chef::RunContext.new(Chef::Node.new, {}, Chef::EventDispatch::Dispatcher.new) }
|
44
|
+
|
45
|
+
before do
|
46
|
+
allow(dsl).to receive(:run_context).and_return(run_context)
|
42
47
|
end
|
43
48
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
+
%w{
|
50
|
+
secret
|
51
|
+
default_secret_service
|
52
|
+
default_secret_config
|
53
|
+
with_secret_service
|
54
|
+
with_secret_config
|
55
|
+
}.each do |m|
|
56
|
+
it "responds to ##{m}" do
|
57
|
+
expect(dsl.respond_to?(m)).to eq true
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "#default_secret_service" do
|
62
|
+
let(:service) { :hashi_vault }
|
63
|
+
|
64
|
+
it "persists the service passed in as an argument" do
|
65
|
+
expect(dsl.default_secret_service).to eq(nil)
|
66
|
+
dsl.default_secret_service(service)
|
67
|
+
expect(dsl.default_secret_service).to eq(service)
|
68
|
+
end
|
69
|
+
|
70
|
+
it "returns run_context.default_secret_service value when no argument is given" do
|
71
|
+
run_context.default_secret_service = :my_thing
|
72
|
+
expect(dsl.default_secret_service).to eq(:my_thing)
|
73
|
+
end
|
74
|
+
|
75
|
+
it "raises exception when service given is not valid" do
|
76
|
+
stub_const("Chef::SecretFetcher::SECRET_FETCHERS", %i{service_a service_b})
|
77
|
+
expect { dsl.default_secret_service(:unknown_service) }.to raise_error(Chef::Exceptions::Secret::InvalidFetcherService)
|
78
|
+
end
|
49
79
|
end
|
50
80
|
|
51
|
-
|
52
|
-
|
53
|
-
|
81
|
+
describe "#with_secret_config" do
|
82
|
+
let(:service) { :hashi_vault }
|
83
|
+
|
84
|
+
it "sets the service for the scope of the block only" do
|
85
|
+
expect(dsl.default_secret_service).to eq(nil)
|
86
|
+
dsl.with_secret_service(service) do
|
87
|
+
expect(dsl.default_secret_service).to eq(service)
|
88
|
+
end
|
89
|
+
expect(dsl.default_secret_service).to eq(nil)
|
90
|
+
end
|
91
|
+
|
92
|
+
it "raises exception when block is not given" do
|
93
|
+
expect { dsl.with_secret_service(service) }.to raise_error(ArgumentError)
|
94
|
+
end
|
54
95
|
end
|
55
96
|
|
56
|
-
|
57
|
-
let(:
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
97
|
+
describe "#default_secret_config" do
|
98
|
+
let(:config) { { my_key: "value" } }
|
99
|
+
|
100
|
+
it "persists the config passed in as argument" do
|
101
|
+
expect(dsl.default_secret_config).to eq({})
|
102
|
+
dsl.default_secret_config(**config)
|
103
|
+
expect(dsl.default_secret_config).to eq(config)
|
104
|
+
end
|
105
|
+
|
106
|
+
it "returns run_context.default_secret_config value when no argument is given" do
|
107
|
+
run_context.default_secret_config = { my_thing: "that" }
|
108
|
+
expect(dsl.default_secret_config).to eq({ my_thing: "that" })
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
describe "#with_secret_config" do
|
113
|
+
let(:config) { { my_key: "value" } }
|
114
|
+
|
115
|
+
it "sets the config for the scope of the block only" do
|
116
|
+
expect(dsl.default_secret_config).to eq({})
|
117
|
+
dsl.with_secret_config(**config) do
|
118
|
+
expect(dsl.default_secret_config).to eq(config)
|
67
119
|
end
|
68
|
-
expect(
|
120
|
+
expect(dsl.default_secret_config).to eq({})
|
121
|
+
end
|
122
|
+
|
123
|
+
it "raises exception when block is not given" do
|
124
|
+
expect { dsl.with_secret_config(**config) }.to raise_error(ArgumentError)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
describe "#secret" do
|
129
|
+
it "uses SecretFetcher.for_service to find the fetcher" do
|
130
|
+
substitute_fetcher = SecretFetcherImpl.new({}, nil)
|
131
|
+
expect(Chef::SecretFetcher).to receive(:for_service).with(:example, {}, run_context).and_return(substitute_fetcher)
|
132
|
+
expect(substitute_fetcher).to receive(:fetch).with("key1", nil)
|
133
|
+
dsl.secret(name: "key1", service: :example, config: {})
|
134
|
+
end
|
135
|
+
|
136
|
+
it "resolves a secret when using the example fetcher" do
|
137
|
+
secret_value = dsl.secret(name: "test1", service: :example, config: { "test1" => "secret value" })
|
138
|
+
expect(secret_value).to eq "secret value"
|
139
|
+
end
|
140
|
+
|
141
|
+
context "when used within a resource" do
|
142
|
+
let(:run_context) {
|
143
|
+
Chef::RunContext.new(Chef::Node.new,
|
144
|
+
Chef::CookbookCollection.new(Chef::CookbookLoader.new(File.join(CHEF_SPEC_DATA, "cookbooks"))),
|
145
|
+
Chef::EventDispatch::Dispatcher.new)
|
146
|
+
}
|
147
|
+
|
148
|
+
it "marks that resource as 'sensitive'" do
|
149
|
+
recipe = Chef::Recipe.new("secrets", "test", run_context)
|
150
|
+
recipe.zen_master "secret_test" do
|
151
|
+
peace secret(name: "test1", service: :example, config: { "test1" => true })
|
152
|
+
end
|
153
|
+
expect(run_context.resource_collection.lookup("zen_master[secret_test]").sensitive).to eql(true)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
it "passes default service to SecretFetcher.for_service" do
|
158
|
+
service = :example
|
159
|
+
dsl.default_secret_service(service)
|
160
|
+
substitute_fetcher = SecretFetcherImpl.new({}, nil)
|
161
|
+
expect(Chef::SecretFetcher).to receive(:for_service).with(service, {}, run_context).and_return(substitute_fetcher)
|
162
|
+
allow(substitute_fetcher).to receive(:fetch).with("key1", nil)
|
163
|
+
dsl.secret(name: "key1")
|
164
|
+
end
|
165
|
+
|
166
|
+
it "passes default config to SecretFetcher.for_service" do
|
167
|
+
config = { my_config: "value" }
|
168
|
+
dsl.default_secret_config(**config)
|
169
|
+
substitute_fetcher = SecretFetcherImpl.new({}, nil)
|
170
|
+
expect(Chef::SecretFetcher).to receive(:for_service).with(:example, config, run_context).and_return(substitute_fetcher)
|
171
|
+
allow(substitute_fetcher).to receive(:fetch).with("key1", nil)
|
172
|
+
dsl.secret(name: "key1", service: :example)
|
69
173
|
end
|
70
174
|
end
|
71
175
|
end
|
@@ -51,4 +51,32 @@ describe Chef::Mixin::Checksum do
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
+
describe "checksum_match?" do
|
55
|
+
context "when checksum cases match" do
|
56
|
+
it "returns true" do
|
57
|
+
expect(@checksum_user.checksum_match?("u7ghbxikk3i9blsimmy2y2ionmxx", "u7ghbxikk3i9blsimmy2y2ionmxx")).to be true
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
context "when one checksum is uppercase and other is lowercase" do
|
62
|
+
it "returns true" do
|
63
|
+
expect(@checksum_user.checksum_match?("U7GHBXIKK3I9BLSIMMY2Y2IONMXX", "u7ghbxikk3i9blsimmy2y2ionmxx")).to be true
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
context "when checksums do not match" do
|
68
|
+
it "returns false" do
|
69
|
+
expect(@checksum_user.checksum_match?("u7ghbxikk3i9blsimmy2y2ionmxx", "09ee9c8cc70501763563bcf9c218")).to be false
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
context "when checksum is nil" do
|
74
|
+
it "returns false" do
|
75
|
+
expect(@checksum_user.checksum_match?("u7ghbxikk3i9blsimmy2y2ionmxx", nil)).to be false
|
76
|
+
expect(@checksum_user.checksum_match?(nil, "09ee9c8cc70501763563bcf9c218")).to be false
|
77
|
+
expect(@checksum_user.checksum_match?(nil, nil)).to be false
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
54
82
|
end
|
@@ -49,6 +49,10 @@ describe Chef::Provider::Package::Chocolatey, :windows_only do
|
|
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
50
|
end
|
51
51
|
|
52
|
+
after(:each) do
|
53
|
+
described_class.instance_variable_set(:@get_choco_version, nil)
|
54
|
+
end
|
55
|
+
|
52
56
|
def allow_remote_list(package_names, args = nil)
|
53
57
|
remote_list_stdout = <<~EOF
|
54
58
|
Chocolatey v0.9.9.11
|
@@ -61,9 +65,9 @@ describe Chef::Provider::Package::Chocolatey, :windows_only do
|
|
61
65
|
remote_list_obj = double(stdout: remote_list_stdout)
|
62
66
|
package_names.each do |pkg|
|
63
67
|
if args
|
64
|
-
allow(provider).to receive(:shell_out_compacted!).with(choco_exe,
|
68
|
+
allow(provider).to receive(:shell_out_compacted!).with(choco_exe, described_class.query_command, "-r", pkg, *args, { returns: [0, 2], timeout: timeout }).and_return(remote_list_obj)
|
65
69
|
else
|
66
|
-
allow(provider).to receive(:shell_out_compacted!).with(choco_exe,
|
70
|
+
allow(provider).to receive(:shell_out_compacted!).with(choco_exe, described_class.query_command, "-r", pkg, { returns: [0, 2], timeout: timeout }).and_return(remote_list_obj)
|
67
71
|
end
|
68
72
|
end
|
69
73
|
end
|
@@ -78,6 +82,18 @@ describe Chef::Provider::Package::Chocolatey, :windows_only do
|
|
78
82
|
end
|
79
83
|
end
|
80
84
|
|
85
|
+
describe "choco searches change with the version" do
|
86
|
+
it "Choco V1 uses List" do
|
87
|
+
allow(described_class).to receive(:get_choco_version).and_return("1.4.0")
|
88
|
+
expect(provider.query_command).to eql("list")
|
89
|
+
end
|
90
|
+
|
91
|
+
it "Choco V2 uses Search" do
|
92
|
+
allow(described_class).to receive(:get_choco_version).and_return("2.1.0")
|
93
|
+
expect(provider.query_command).to eql("search")
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
81
97
|
describe "#candidate_version" do
|
82
98
|
it "should set the candidate_version to the latest version when not pinning" do
|
83
99
|
allow_remote_list(["git"])
|
@@ -150,7 +166,7 @@ describe Chef::Provider::Package::Chocolatey, :windows_only do
|
|
150
166
|
new_resource.package_name("package-does-not-exist")
|
151
167
|
new_resource.returns([0])
|
152
168
|
allow(provider).to receive(:shell_out_compacted!)
|
153
|
-
.with(choco_exe,
|
169
|
+
.with(choco_exe, described_class.query_command, "-r", new_resource.package_name.first, { returns: new_resource.returns, timeout: timeout })
|
154
170
|
.and_raise(Mixlib::ShellOut::ShellCommandFailed, "Expected process to exit with [0], but received '2'")
|
155
171
|
expect { provider.send(:available_packages) }.to raise_error(Mixlib::ShellOut::ShellCommandFailed, "Expected process to exit with [0], but received '2'")
|
156
172
|
end
|
@@ -143,7 +143,7 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
|
|
143
143
|
.to_return(status: 200, body: File.binread(File.join(CHEF_SPEC_DATA, "rubygems.org", "sexp_processor-4.15.1.gemspec.rz")))
|
144
144
|
|
145
145
|
dep = Gem::Dependency.new("sexp_processor", ">= 0")
|
146
|
-
expect(@gem_env.candidate_version_from_remote(dep, "https://rubygems2.org")).to
|
146
|
+
expect(@gem_env.candidate_version_from_remote(dep, "https://rubygems2.org")).to be_nil
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
@@ -70,4 +70,59 @@ describe Chef::Provider::User::Linux do
|
|
70
70
|
expect( provider.useradd_options ).to eql(["-m"])
|
71
71
|
end
|
72
72
|
end
|
73
|
+
|
74
|
+
describe "compare_user_linux" do
|
75
|
+
before(:each) do
|
76
|
+
@new_resource = Chef::Resource::User::LinuxUser.new("notarealuser")
|
77
|
+
@current_resource = Chef::Resource::User::LinuxUser.new("notarealuser")
|
78
|
+
end
|
79
|
+
|
80
|
+
let(:mapping) do
|
81
|
+
{
|
82
|
+
"username" => %w{notarealuser notarealuser},
|
83
|
+
"comment" => ["Nota Realuser", "Not a Realuser"],
|
84
|
+
"uid" => [1000, 1001],
|
85
|
+
"gid" => [1000, 1001],
|
86
|
+
"home" => ["/home/notarealuser", "/Users/notarealuser"],
|
87
|
+
"shell" => ["/usr/bin/zsh", "/bin/bash"],
|
88
|
+
"password" => %w{abcd 12345},
|
89
|
+
"sensitive" => [true],
|
90
|
+
}
|
91
|
+
end
|
92
|
+
|
93
|
+
%w{uid gid comment home shell password}.each do |property|
|
94
|
+
it "should return true if #{property} doesn't match" do
|
95
|
+
@new_resource.send(property, mapping[property][0])
|
96
|
+
@current_resource.send(property, mapping[property][1])
|
97
|
+
expect(provider.compare_user).to eql(true)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
it "should show a blank for password if sensitive set to true" do
|
102
|
+
@new_resource.password mapping["password"][0]
|
103
|
+
@current_resource.password mapping["password"][1]
|
104
|
+
@new_resource.sensitive true
|
105
|
+
@current_resource.sensitive true
|
106
|
+
provider.compare_user
|
107
|
+
expect(provider.change_desc).to eql(["change password from ******** to ********"])
|
108
|
+
end
|
109
|
+
|
110
|
+
%w{uid gid}.each do |property|
|
111
|
+
it "should return false if string #{property} matches fixnum" do
|
112
|
+
@new_resource.send(property, "100")
|
113
|
+
@current_resource.send(property, 100)
|
114
|
+
expect(provider.compare_user).to eql(false)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
it "should return false if the objects are identical" do
|
119
|
+
expect(provider.compare_user).to eql(false)
|
120
|
+
end
|
121
|
+
|
122
|
+
it "should ignore differences in trailing slash in home paths" do
|
123
|
+
@new_resource.home "/home/notarealuser"
|
124
|
+
@current_resource.home "/home/notarealuser/"
|
125
|
+
expect(provider.compare_user).to eql(false)
|
126
|
+
end
|
127
|
+
end
|
73
128
|
end
|
@@ -134,4 +134,12 @@ describe Chef::Resource::ChefClientConfig do
|
|
134
134
|
expect(provider.format_handler([{ "class" => "Foo", "arguments" => ["'one'", "two", "three"] }])).to eql(["Foo.new('one',two,three)"])
|
135
135
|
end
|
136
136
|
end
|
137
|
+
|
138
|
+
describe "rubygems_url property" do
|
139
|
+
it "accepts nil, a single URL, or an array of URLs" do
|
140
|
+
expect { resource.rubygems_url(nil) }.not_to raise_error
|
141
|
+
expect { resource.rubygems_url("https://rubygems.internal.example.com") }.not_to raise_error
|
142
|
+
expect { resource.rubygems_url(["https://rubygems.east.example.com", "https://rubygems.west.example.com"]) }.not_to raise_error
|
143
|
+
end
|
144
|
+
end
|
137
145
|
end
|
@@ -39,12 +39,12 @@ describe Chef::Resource::MacosUserDefaults, :macos_only do
|
|
39
39
|
expect(resource.domain).to eq("NSGlobalDomain")
|
40
40
|
end
|
41
41
|
|
42
|
-
it "
|
43
|
-
expect(resource.host).to
|
42
|
+
it ":all for the host property" do
|
43
|
+
expect(resource.host).to eq(:all)
|
44
44
|
end
|
45
45
|
|
46
|
-
it "
|
47
|
-
expect(resource.user).to
|
46
|
+
it ":current for the user property" do
|
47
|
+
expect(resource.user).to eq(:current)
|
48
48
|
end
|
49
49
|
|
50
50
|
it ":write for resource action" do
|
data/spec/unit/resource_spec.rb
CHANGED
@@ -371,6 +371,9 @@ describe Chef::Resource do
|
|
371
371
|
end
|
372
372
|
|
373
373
|
describe "to_text" do
|
374
|
+
|
375
|
+
let(:sensitive_property_masked_value) { "sensitive value suppressed" }
|
376
|
+
|
374
377
|
it "prints nice message" do
|
375
378
|
resource_class = Class.new(Chef::Resource) { property :foo, String }
|
376
379
|
resource = resource_class.new("sensitive_property_tests")
|
@@ -383,7 +386,25 @@ describe Chef::Resource do
|
|
383
386
|
resource_class = Class.new(Chef::Resource) { property :foo, String, sensitive: true }
|
384
387
|
resource = resource_class.new("sensitive_property_tests")
|
385
388
|
resource.foo = "some value"
|
386
|
-
expect(resource.to_text).to match(/foo "\*
|
389
|
+
expect(resource.to_text).to match(/foo "\*#{sensitive_property_masked_value}\*"/)
|
390
|
+
end
|
391
|
+
|
392
|
+
it "suppresses that properties value irrespective of desired state (false) " do
|
393
|
+
resource_class = Class.new(Chef::Resource) {
|
394
|
+
property :suppressed_content, String, sensitive: true, desired_state: false
|
395
|
+
}
|
396
|
+
resource = resource_class.new("desired_state_property_tests")
|
397
|
+
resource.suppressed_content = "some value"
|
398
|
+
expect(resource.to_text).to match(/suppressed_content "\*#{sensitive_property_masked_value}\*"/)
|
399
|
+
end
|
400
|
+
|
401
|
+
it "suppresses that properties value irrespective of desired state (true) " do
|
402
|
+
resource_class = Class.new(Chef::Resource) {
|
403
|
+
property :desired_state_content, String, sensitive: true, desired_state: true
|
404
|
+
}
|
405
|
+
resource = resource_class.new("desired_state_property_tests")
|
406
|
+
resource.desired_state_content = "some value"
|
407
|
+
expect(resource.to_text).to match(/desired_state_content "\*#{sensitive_property_masked_value}\*"/)
|
387
408
|
end
|
388
409
|
end
|
389
410
|
|
@@ -53,6 +53,22 @@ describe Chef::RunContext do
|
|
53
53
|
expect(run_context.node).to eq(node)
|
54
54
|
end
|
55
55
|
|
56
|
+
it "responds to #default_secret_service" do
|
57
|
+
expect(run_context).to respond_to(:default_secret_service)
|
58
|
+
end
|
59
|
+
|
60
|
+
it "responds to #default_secret_config" do
|
61
|
+
expect(run_context).to respond_to(:default_secret_config)
|
62
|
+
end
|
63
|
+
|
64
|
+
it "#default_secret_service defaults to nil" do
|
65
|
+
expect(run_context.default_secret_service).to eq(nil)
|
66
|
+
end
|
67
|
+
|
68
|
+
it "#default_secret_config defaults to {}" do
|
69
|
+
expect(run_context.default_secret_config).to eq({})
|
70
|
+
end
|
71
|
+
|
56
72
|
it "loads up node[:cookbooks]" do
|
57
73
|
expect(run_context.node[:cookbooks]).to eql(
|
58
74
|
{
|
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.95
|
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:
|
11
|
+
date: 2023-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef-config
|
@@ -16,48 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 17.10.
|
19
|
+
version: 17.10.95
|
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.95
|
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.95
|
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.95
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: train-core
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
48
|
-
- - ">="
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: 3.2.28
|
47
|
+
version: '3.10'
|
51
48
|
type: :runtime
|
52
49
|
prerelease: false
|
53
50
|
version_requirements: !ruby/object:Gem::Requirement
|
54
51
|
requirements:
|
55
52
|
- - "~>"
|
56
53
|
- !ruby/object:Gem::Version
|
57
|
-
version: '3.
|
58
|
-
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: 3.2.28
|
54
|
+
version: '3.10'
|
61
55
|
- !ruby/object:Gem::Dependency
|
62
56
|
name: train-winrm
|
63
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -210,30 +204,30 @@ dependencies:
|
|
210
204
|
name: inspec-core
|
211
205
|
requirement: !ruby/object:Gem::Requirement
|
212
206
|
requirements:
|
213
|
-
- - "
|
207
|
+
- - ">="
|
214
208
|
- !ruby/object:Gem::Version
|
215
209
|
version: '4.23'
|
216
210
|
type: :runtime
|
217
211
|
prerelease: false
|
218
212
|
version_requirements: !ruby/object:Gem::Requirement
|
219
213
|
requirements:
|
220
|
-
- - "
|
214
|
+
- - ">="
|
221
215
|
- !ruby/object:Gem::Version
|
222
216
|
version: '4.23'
|
223
217
|
- !ruby/object:Gem::Dependency
|
224
218
|
name: ffi
|
225
219
|
requirement: !ruby/object:Gem::Requirement
|
226
220
|
requirements:
|
227
|
-
- - "
|
221
|
+
- - "~>"
|
228
222
|
- !ruby/object:Gem::Version
|
229
|
-
version: 1.
|
223
|
+
version: 1.15.0
|
230
224
|
type: :runtime
|
231
225
|
prerelease: false
|
232
226
|
version_requirements: !ruby/object:Gem::Requirement
|
233
227
|
requirements:
|
234
|
-
- - "
|
228
|
+
- - "~>"
|
235
229
|
- !ruby/object:Gem::Version
|
236
|
-
version: 1.
|
230
|
+
version: 1.15.0
|
237
231
|
- !ruby/object:Gem::Dependency
|
238
232
|
name: ffi-yajl
|
239
233
|
requirement: !ruby/object:Gem::Requirement
|
@@ -257,7 +251,7 @@ dependencies:
|
|
257
251
|
version: 2.1.2
|
258
252
|
- - "<"
|
259
253
|
- !ruby/object:Gem::Version
|
260
|
-
version: '
|
254
|
+
version: '5.0'
|
261
255
|
type: :runtime
|
262
256
|
prerelease: false
|
263
257
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -267,7 +261,7 @@ dependencies:
|
|
267
261
|
version: 2.1.2
|
268
262
|
- - "<"
|
269
263
|
- !ruby/object:Gem::Version
|
270
|
-
version: '
|
264
|
+
version: '5.0'
|
271
265
|
- !ruby/object:Gem::Dependency
|
272
266
|
name: erubis
|
273
267
|
requirement: !ruby/object:Gem::Requirement
|
@@ -607,33 +601,47 @@ dependencies:
|
|
607
601
|
- !ruby/object:Gem::Version
|
608
602
|
version: '3.0'
|
609
603
|
- !ruby/object:Gem::Dependency
|
610
|
-
name:
|
604
|
+
name: win32-taskscheduler
|
611
605
|
requirement: !ruby/object:Gem::Requirement
|
612
606
|
requirements:
|
613
607
|
- - "~>"
|
614
608
|
- !ruby/object:Gem::Version
|
615
|
-
version: '
|
609
|
+
version: '2.0'
|
616
610
|
type: :runtime
|
617
611
|
prerelease: false
|
618
612
|
version_requirements: !ruby/object:Gem::Requirement
|
619
613
|
requirements:
|
620
614
|
- - "~>"
|
621
615
|
- !ruby/object:Gem::Version
|
622
|
-
version: '
|
616
|
+
version: '2.0'
|
623
617
|
- !ruby/object:Gem::Dependency
|
624
|
-
name: win32-
|
618
|
+
name: win32-certstore
|
625
619
|
requirement: !ruby/object:Gem::Requirement
|
626
620
|
requirements:
|
627
621
|
- - "~>"
|
628
622
|
- !ruby/object:Gem::Version
|
629
|
-
version:
|
623
|
+
version: 0.6.15
|
630
624
|
type: :runtime
|
631
625
|
prerelease: false
|
632
626
|
version_requirements: !ruby/object:Gem::Requirement
|
633
627
|
requirements:
|
634
628
|
- - "~>"
|
635
629
|
- !ruby/object:Gem::Version
|
636
|
-
version:
|
630
|
+
version: 0.6.15
|
631
|
+
- !ruby/object:Gem::Dependency
|
632
|
+
name: wmi-lite
|
633
|
+
requirement: !ruby/object:Gem::Requirement
|
634
|
+
requirements:
|
635
|
+
- - "~>"
|
636
|
+
- !ruby/object:Gem::Version
|
637
|
+
version: '1.0'
|
638
|
+
type: :runtime
|
639
|
+
prerelease: false
|
640
|
+
version_requirements: !ruby/object:Gem::Requirement
|
641
|
+
requirements:
|
642
|
+
- - "~>"
|
643
|
+
- !ruby/object:Gem::Version
|
644
|
+
version: '1.0'
|
637
645
|
- !ruby/object:Gem::Dependency
|
638
646
|
name: iso8601
|
639
647
|
requirement: !ruby/object:Gem::Requirement
|
@@ -654,20 +662,6 @@ dependencies:
|
|
654
662
|
- - "<"
|
655
663
|
- !ruby/object:Gem::Version
|
656
664
|
version: '0.14'
|
657
|
-
- !ruby/object:Gem::Dependency
|
658
|
-
name: win32-certstore
|
659
|
-
requirement: !ruby/object:Gem::Requirement
|
660
|
-
requirements:
|
661
|
-
- - "~>"
|
662
|
-
- !ruby/object:Gem::Version
|
663
|
-
version: 0.6.2
|
664
|
-
type: :runtime
|
665
|
-
prerelease: false
|
666
|
-
version_requirements: !ruby/object:Gem::Requirement
|
667
|
-
requirements:
|
668
|
-
- - "~>"
|
669
|
-
- !ruby/object:Gem::Version
|
670
|
-
version: 0.6.2
|
671
665
|
- !ruby/object:Gem::Dependency
|
672
666
|
name: chef-powershell
|
673
667
|
requirement: !ruby/object:Gem::Requirement
|
@@ -2456,10 +2450,10 @@ files:
|
|
2456
2450
|
- spec/functional/assets/PkgA.1.0.0.0.bff
|
2457
2451
|
- spec/functional/assets/PkgA.2.0.0.0.bff
|
2458
2452
|
- spec/functional/assets/chefinittest
|
2459
|
-
- spec/functional/assets/chocolatey_feed/test-A.1.0.nupkg
|
2460
|
-
- spec/functional/assets/chocolatey_feed/test-A.1.5.nupkg
|
2461
|
-
- spec/functional/assets/chocolatey_feed/test-A.2.0.nupkg
|
2462
|
-
- spec/functional/assets/chocolatey_feed/test-B.1.0.nupkg
|
2453
|
+
- spec/functional/assets/chocolatey_feed/test-A.1.0.0.nupkg
|
2454
|
+
- spec/functional/assets/chocolatey_feed/test-A.1.5.0.nupkg
|
2455
|
+
- spec/functional/assets/chocolatey_feed/test-A.2.0.0.nupkg
|
2456
|
+
- spec/functional/assets/chocolatey_feed/test-B.1.0.0.nupkg
|
2463
2457
|
- spec/functional/assets/dummy-1-0.aix6.1.noarch.rpm
|
2464
2458
|
- spec/functional/assets/dummy-2-0.aix6.1.noarch.rpm
|
2465
2459
|
- spec/functional/assets/inittest
|
@@ -2480,12 +2474,12 @@ files:
|
|
2480
2474
|
- spec/functional/assets/yumrepo/chef_rpm-1.2-1.s390x.rpm
|
2481
2475
|
- spec/functional/assets/yumrepo/chef_rpm-1.2-1.src.rpm
|
2482
2476
|
- spec/functional/assets/yumrepo/chef_rpm-1.2-1.x86_64.rpm
|
2483
|
-
- spec/functional/assets/yumrepo/repodata/
|
2484
|
-
- spec/functional/assets/yumrepo/repodata/
|
2485
|
-
- spec/functional/assets/yumrepo/repodata/
|
2486
|
-
- spec/functional/assets/yumrepo/repodata/
|
2487
|
-
- spec/functional/assets/yumrepo/repodata/
|
2488
|
-
- spec/functional/assets/yumrepo/repodata/
|
2477
|
+
- spec/functional/assets/yumrepo/repodata/01a3b-filelists.sqlite.bz2
|
2478
|
+
- spec/functional/assets/yumrepo/repodata/401dc-filelists.xml.gz
|
2479
|
+
- spec/functional/assets/yumrepo/repodata/5dc1e-primary.sqlite.bz2
|
2480
|
+
- spec/functional/assets/yumrepo/repodata/6bf96-other.xml.gz
|
2481
|
+
- spec/functional/assets/yumrepo/repodata/7c365-other.sqlite.bz2
|
2482
|
+
- spec/functional/assets/yumrepo/repodata/dabe2-primary.xml.gz
|
2489
2483
|
- spec/functional/assets/yumrepo/repodata/filelists.xml.gz
|
2490
2484
|
- spec/functional/assets/yumrepo/repodata/other.xml.gz
|
2491
2485
|
- spec/functional/assets/yumrepo/repodata/primary.xml.gz
|
@@ -3180,14 +3174,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
3180
3174
|
requirements:
|
3181
3175
|
- - ">="
|
3182
3176
|
- !ruby/object:Gem::Version
|
3183
|
-
version: 2.
|
3177
|
+
version: 2.7.0
|
3184
3178
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
3185
3179
|
requirements:
|
3186
3180
|
- - ">="
|
3187
3181
|
- !ruby/object:Gem::Version
|
3188
3182
|
version: '0'
|
3189
3183
|
requirements: []
|
3190
|
-
rubygems_version: 3.2.
|
3184
|
+
rubygems_version: 3.2.33
|
3191
3185
|
signing_key:
|
3192
3186
|
specification_version: 4
|
3193
3187
|
summary: A systems integration framework, built to bring the benefits of configuration
|
File without changes
|