chef 17.1.35-universal-mingw32 → 17.4.38-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 +6 -4
- data/chef.gemspec +1 -0
- data/lib/chef/action_collection.rb +6 -26
- data/lib/chef/application/base.rb +15 -0
- data/lib/chef/application.rb +4 -2
- data/lib/chef/client.rb +7 -1
- data/lib/chef/compliance/default_attributes.rb +5 -3
- data/lib/chef/compliance/reporter/automate.rb +1 -1
- data/lib/chef/compliance/runner.rb +16 -2
- data/lib/chef/cookbook_version.rb +26 -4
- data/lib/chef/data_collector/run_end_message.rb +1 -1
- data/lib/chef/data_collector.rb +0 -1
- data/lib/chef/deprecated.rb +14 -4
- data/lib/chef/dsl/render_helpers.rb +44 -0
- data/lib/chef/dsl/secret.rb +64 -0
- data/lib/chef/dsl/toml.rb +116 -0
- data/lib/chef/dsl/universal.rb +5 -0
- data/lib/chef/dsl.rb +1 -0
- data/lib/chef/event_dispatch/base.rb +2 -1
- data/lib/chef/exceptions.rb +23 -0
- data/lib/chef/formatters/doc.rb +14 -13
- data/lib/chef/formatters/error_mapper.rb +2 -2
- data/lib/chef/formatters/minimal.rb +6 -5
- data/lib/chef/handler/slow_report.rb +66 -0
- data/lib/chef/handler.rb +46 -8
- data/lib/chef/http.rb +5 -5
- data/lib/chef/json_compat.rb +1 -1
- data/lib/chef/node.rb +20 -19
- data/lib/chef/policy_builder/policyfile.rb +88 -45
- data/lib/chef/provider/execute.rb +1 -1
- data/lib/chef/provider/file.rb +2 -2
- data/lib/chef/provider/group/dscl.rb +1 -1
- data/lib/chef/provider/launchd.rb +6 -6
- data/lib/chef/provider/lwrp_base.rb +1 -1
- data/lib/chef/provider/package/habitat.rb +168 -0
- data/lib/chef/provider/package/powershell.rb +5 -0
- data/lib/chef/provider/subversion.rb +4 -4
- data/lib/chef/provider/support/yum_repo.erb +1 -1
- data/lib/chef/provider/support/zypper_repo.erb +4 -2
- data/lib/chef/provider/systemd_unit.rb +17 -16
- data/lib/chef/provider/user/mac.rb +3 -3
- data/lib/chef/provider/yum_repository.rb +27 -43
- data/lib/chef/provider/zypper_repository.rb +30 -34
- data/lib/chef/provider.rb +26 -1
- data/lib/chef/provider_resolver.rb +8 -2
- data/lib/chef/providers.rb +1 -0
- data/lib/chef/resource/alternatives.rb +5 -5
- data/lib/chef/resource/apt_preference.rb +2 -2
- data/lib/chef/resource/apt_repository.rb +2 -2
- data/lib/chef/resource/apt_update.rb +4 -4
- data/lib/chef/resource/build_essential.rb +1 -1
- data/lib/chef/resource/chef_client_config.rb +10 -5
- data/lib/chef/resource/chef_client_cron.rb +3 -3
- data/lib/chef/resource/chef_client_launchd.rb +3 -3
- data/lib/chef/resource/chef_client_scheduled_task.rb +15 -15
- data/lib/chef/resource/chef_client_systemd_timer.rb +3 -3
- data/lib/chef/resource/chef_client_trusted_certificate.rb +2 -2
- data/lib/chef/resource/chef_handler.rb +2 -2
- data/lib/chef/resource/chef_sleep.rb +1 -1
- data/lib/chef/resource/chef_vault_secret.rb +2 -2
- data/lib/chef/resource/chocolatey_feature.rb +2 -2
- data/lib/chef/resource/chocolatey_source.rb +1 -1
- data/lib/chef/resource/cron/cron_d.rb +4 -6
- data/lib/chef/resource/cron_access.rb +1 -1
- data/lib/chef/resource/dmg_package.rb +1 -1
- data/lib/chef/resource/dsc_resource.rb +1 -1
- data/lib/chef/resource/execute.rb +5 -5
- data/lib/chef/resource/gem_package.rb +2 -1
- data/lib/chef/resource/group.rb +4 -4
- data/lib/chef/resource/habitat/_habitat_shared.rb +28 -0
- data/lib/chef/resource/habitat/habitat_package.rb +129 -0
- data/lib/chef/resource/habitat/habitat_sup.rb +329 -0
- data/lib/chef/resource/habitat/habitat_sup_systemd.rb +67 -0
- data/lib/chef/resource/habitat/habitat_sup_windows.rb +90 -0
- data/lib/chef/resource/habitat_config.rb +107 -0
- data/lib/chef/resource/habitat_install.rb +247 -0
- data/lib/chef/resource/habitat_service.rb +451 -0
- data/lib/chef/resource/habitat_user_toml.rb +92 -0
- data/lib/chef/resource/homebrew_cask.rb +18 -7
- data/lib/chef/resource/homebrew_package.rb +1 -1
- data/lib/chef/resource/homebrew_tap.rb +4 -3
- data/lib/chef/resource/homebrew_update.rb +2 -2
- data/lib/chef/resource/hostname.rb +49 -7
- data/lib/chef/resource/inspec_waiver_file_entry.rb +8 -7
- data/lib/chef/resource/kernel_module.rb +6 -6
- data/lib/chef/resource/launchd.rb +3 -3
- data/lib/chef/resource/locale.rb +1 -1
- data/lib/chef/resource/lwrp_base.rb +1 -1
- data/lib/chef/resource/macos_userdefaults.rb +2 -2
- data/lib/chef/resource/ohai_hint.rb +2 -6
- data/lib/chef/resource/openbsd_package.rb +17 -0
- data/lib/chef/resource/openssl_dhparam.rb +1 -2
- data/lib/chef/resource/openssl_ec_private_key.rb +1 -3
- data/lib/chef/resource/openssl_ec_public_key.rb +1 -3
- data/lib/chef/resource/openssl_rsa_private_key.rb +1 -3
- data/lib/chef/resource/openssl_rsa_public_key.rb +1 -3
- data/lib/chef/resource/openssl_x509_certificate.rb +1 -4
- data/lib/chef/resource/openssl_x509_crl.rb +1 -3
- data/lib/chef/resource/openssl_x509_request.rb +1 -3
- data/lib/chef/resource/osx_profile.rb +3 -3
- data/lib/chef/resource/plist.rb +1 -1
- data/lib/chef/resource/powershell_package_source.rb +2 -4
- data/lib/chef/resource/reboot.rb +38 -9
- data/lib/chef/resource/remote_directory.rb +2 -2
- data/lib/chef/resource/remote_file.rb +1 -1
- data/lib/chef/resource/rhsm_errata.rb +0 -2
- data/lib/chef/resource/rhsm_errata_level.rb +1 -5
- data/lib/chef/resource/rhsm_repo.rb +15 -0
- data/lib/chef/resource/rhsm_subscription.rb +5 -5
- data/lib/chef/resource/ruby_block.rb +100 -0
- data/lib/chef/resource/scm/subversion.rb +1 -1
- data/lib/chef/resource/ssh_known_hosts_entry.rb +4 -7
- data/lib/chef/resource/sudo.rb +2 -6
- data/lib/chef/resource/support/HabService.dll.config.erb +19 -0
- data/lib/chef/resource/support/client.erb +8 -1
- data/lib/chef/resource/support/sup.toml.erb +179 -0
- data/lib/chef/resource/swap_file.rb +2 -6
- data/lib/chef/resource/sysctl.rb +2 -2
- data/lib/chef/resource/systemd_unit.rb +3 -3
- data/lib/chef/resource/timezone.rb +1 -1
- data/lib/chef/resource/user_ulimit.rb +2 -2
- data/lib/chef/resource/windows_ad_join.rb +2 -2
- data/lib/chef/resource/windows_audit_policy.rb +2 -2
- data/lib/chef/resource/windows_auto_run.rb +2 -2
- data/lib/chef/resource/windows_certificate.rb +1 -1
- data/lib/chef/resource/windows_defender.rb +163 -0
- data/lib/chef/resource/windows_defender_exclusion.rb +125 -0
- data/lib/chef/resource/windows_dfs_folder.rb +2 -2
- data/lib/chef/resource/windows_dfs_namespace.rb +2 -2
- data/lib/chef/resource/windows_dns_record.rb +2 -2
- data/lib/chef/resource/windows_dns_zone.rb +2 -2
- data/lib/chef/resource/windows_feature.rb +3 -3
- data/lib/chef/resource/windows_feature_dism.rb +3 -5
- data/lib/chef/resource/windows_feature_powershell.rb +3 -3
- data/lib/chef/resource/windows_firewall_profile.rb +2 -2
- data/lib/chef/resource/windows_firewall_rule.rb +20 -6
- data/lib/chef/resource/windows_font.rb +1 -1
- data/lib/chef/resource/windows_pagefile.rb +103 -64
- data/lib/chef/resource/windows_path.rb +2 -2
- data/lib/chef/resource/windows_printer.rb +80 -61
- data/lib/chef/resource/windows_printer_port.rb +48 -65
- data/lib/chef/resource/windows_security_policy.rb +2 -2
- data/lib/chef/resource/windows_share.rb +2 -2
- data/lib/chef/resource/windows_shortcut.rb +1 -1
- data/lib/chef/resource/windows_task.rb +1 -1
- data/lib/chef/resource/windows_uac.rb +3 -5
- data/lib/chef/resource/windows_update_settings.rb +259 -0
- data/lib/chef/resource/windows_user_privilege.rb +2 -2
- data/lib/chef/resource/windows_workgroup.rb +2 -2
- data/lib/chef/resource/yum_package.rb +11 -15
- data/lib/chef/resource/zypper_package.rb +4 -4
- data/lib/chef/resource/zypper_repository.rb +28 -8
- data/lib/chef/resource.rb +13 -17
- data/lib/chef/resource_inspector.rb +6 -2
- data/lib/chef/resource_reporter.rb +0 -1
- data/lib/chef/resources.rb +12 -1
- data/lib/chef/secret_fetcher/aws_secrets_manager.rb +65 -0
- data/lib/chef/secret_fetcher/azure_key_vault.rb +78 -0
- data/lib/chef/secret_fetcher/base.rb +76 -0
- data/lib/chef/secret_fetcher/example.rb +46 -0
- data/lib/chef/secret_fetcher.rb +55 -0
- data/lib/chef/version.rb +1 -1
- data/spec/functional/mixin/from_file_spec.rb +1 -1
- data/spec/functional/resource/windows_hostname_spec.rb +91 -0
- data/spec/functional/resource/windows_pagefile_spec.rb +98 -0
- data/spec/integration/compliance/compliance_spec.rb +1 -0
- data/spec/integration/recipes/recipe_dsl_spec.rb +1 -1
- data/spec/integration/recipes/resource_action_spec.rb +6 -6
- data/spec/support/shared/unit/provider/file.rb +2 -8
- data/spec/unit/compliance/runner_spec.rb +46 -2
- data/spec/unit/cookbook_version_spec.rb +52 -0
- data/spec/unit/data_collector_spec.rb +47 -1
- data/spec/unit/dsl/render_helpers_spec.rb +102 -0
- data/spec/unit/dsl/secret_spec.rb +71 -0
- data/spec/unit/formatters/doc_spec.rb +1 -1
- data/spec/unit/handler_spec.rb +8 -2
- data/spec/unit/policy_builder/dynamic_spec.rb +0 -5
- data/spec/unit/policy_builder/policyfile_spec.rb +144 -56
- data/spec/unit/provider/apt_update_spec.rb +3 -1
- data/spec/unit/provider/mount/aix_spec.rb +1 -1
- data/spec/unit/provider/package/powershell_spec.rb +74 -12
- data/spec/unit/provider/zypper_repository_spec.rb +3 -10
- data/spec/unit/provider_spec.rb +23 -0
- data/spec/unit/resource/homebrew_cask_spec.rb +29 -11
- data/spec/unit/resource/rhsm_subscription_spec.rb +50 -3
- data/spec/unit/resource/systemd_unit_spec.rb +1 -1
- data/spec/unit/resource/windows_defender_exclusion_spec.rb +62 -0
- data/spec/unit/resource/windows_defender_spec.rb +71 -0
- data/spec/unit/resource/windows_firewall_rule_spec.rb +12 -7
- data/spec/unit/resource/windows_pagefile_spec.rb +4 -9
- data/spec/unit/resource/windows_update_settings_spec.rb +64 -0
- data/spec/unit/resource/zypper_repository_spec.rb +1 -1
- data/spec/unit/resource_spec.rb +19 -8
- data/spec/unit/secret_fetcher/aws_secrets_manager_spec.rb +70 -0
- data/spec/unit/secret_fetcher/azure_key_vault_spec.rb +70 -0
- data/spec/unit/secret_fetcher_spec.rb +82 -0
- metadata +55 -7
data/spec/unit/resource_spec.rb
CHANGED
@@ -1172,21 +1172,23 @@ describe Chef::Resource do
|
|
1172
1172
|
action :base_action3, description: "unmodified base action 3 desc" do; end
|
1173
1173
|
end
|
1174
1174
|
|
1175
|
+
let(:resource_inst) { TestResource.new("TestResource", nil) }
|
1176
|
+
|
1175
1177
|
it "returns nil when no description was provided for the action" do
|
1176
|
-
expect(
|
1178
|
+
expect(resource_inst.action_description(:base_action0)).to eql(nil)
|
1177
1179
|
end
|
1178
1180
|
|
1179
1181
|
context "when action definition is a string" do
|
1180
1182
|
it "returns the description whether a symbol or string is used to look it up" do
|
1181
|
-
expect(
|
1182
|
-
expect(
|
1183
|
+
expect(resource_inst.action_description("string_action")).to eql("a string test")
|
1184
|
+
expect(resource_inst.action_description(:string_action)).to eql("a string test")
|
1183
1185
|
end
|
1184
1186
|
end
|
1185
1187
|
|
1186
1188
|
context "when action definition is a symbol" do
|
1187
1189
|
it "returns the description whether a symbol or string is used to look up" do
|
1188
|
-
expect(
|
1189
|
-
expect(
|
1190
|
+
expect(resource_inst.action_description("symbol_action")).to eql("a symbol test")
|
1191
|
+
expect(resource_inst.action_description(:symbol_action)).to eql("a symbol test")
|
1190
1192
|
end
|
1191
1193
|
end
|
1192
1194
|
|
@@ -1196,14 +1198,23 @@ describe Chef::Resource do
|
|
1196
1198
|
action :base_action3 do; end
|
1197
1199
|
end
|
1198
1200
|
|
1201
|
+
class TestResourceChild2 < TestResource
|
1202
|
+
# We should never see this description
|
1203
|
+
action :base_action2, description: "if you see this in an error, TestResourceChild was polluted with this description" do; end
|
1204
|
+
end
|
1205
|
+
let(:resource_inst) { TestResourceChild.new("TestResource", nil) }
|
1206
|
+
|
1199
1207
|
it "returns original description when a described action is not overridden in child resource" do
|
1200
|
-
expect(
|
1208
|
+
expect(resource_inst.action_description(:base_action1)).to eq "unmodified base action 1 desc"
|
1201
1209
|
end
|
1202
1210
|
it "returns original description when the child resource overrides an inherited action but NOT its description" do
|
1203
|
-
expect(
|
1211
|
+
expect(resource_inst.action_description(:base_action3)).to eq "unmodified base action 3 desc"
|
1212
|
+
end
|
1213
|
+
it "returns new description when the child resource overrides an inherited action and its description" do
|
1214
|
+
expect(resource_inst.action_description(:base_action2)).to eq "modified base action 2 desc"
|
1204
1215
|
end
|
1205
1216
|
it "returns new description when the child resource overrides an inherited action and its description" do
|
1206
|
-
expect(
|
1217
|
+
expect(resource_inst.action_description(:base_action2)).to eq "modified base action 2 desc"
|
1207
1218
|
end
|
1208
1219
|
end
|
1209
1220
|
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Marc Paradise <marc@chef.io>
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
#
|
19
|
+
|
20
|
+
require_relative "../../spec_helper"
|
21
|
+
require "chef/secret_fetcher/aws_secrets_manager"
|
22
|
+
|
23
|
+
describe Chef::SecretFetcher::AWSSecretsManager do
|
24
|
+
let(:node) { {} }
|
25
|
+
let(:aws_global_config) { {} }
|
26
|
+
let(:fetcher_config) { {} }
|
27
|
+
let(:run_context) { double("run_context", node: node) }
|
28
|
+
let(:fetcher) {
|
29
|
+
Chef::SecretFetcher::AWSSecretsManager.new( fetcher_config, run_context )
|
30
|
+
}
|
31
|
+
|
32
|
+
before do
|
33
|
+
allow(Aws).to receive(:config).and_return(aws_global_config)
|
34
|
+
end
|
35
|
+
|
36
|
+
context "when region is provided" do
|
37
|
+
let(:fetcher_config) { { region: "region-from-caller" } }
|
38
|
+
it "uses the provided region" do
|
39
|
+
fetcher.validate!
|
40
|
+
expect(fetcher.config[:region]).to eq "region-from-caller"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context "when region is not provided" do
|
45
|
+
context "and no region exists in AWS config or node attributes" do
|
46
|
+
it "raises a ConfigurationInvalid error" do
|
47
|
+
expect { fetcher.validate! }.to raise_error Chef::Exceptions::Secret::ConfigurationInvalid
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context "and region exists in AWS config and node attributes" do
|
52
|
+
let(:aws_global_config) { { region: "region-from-aws-global-config" } }
|
53
|
+
let(:node) { { "ec2" => { "region" => "region-from-ohai-data" } } }
|
54
|
+
it "uses the region from AWS config" do
|
55
|
+
fetcher.validate!
|
56
|
+
expect(fetcher.config[:region]).to eq "region-from-aws-global-config"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
context "and region exists only in node attributes" do
|
61
|
+
let(:node) { { "ec2" => { "region" => "region-from-ohai-data" } } }
|
62
|
+
it "uses the region from AWS config" do
|
63
|
+
fetcher.validate!
|
64
|
+
expect(fetcher.config[:region]).to eq "region-from-ohai-data"
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Author:: Marc Paradise <marc@chef.io>
|
4
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
5
|
+
# License:: Apache License, Version 2.0
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
require_relative "../../spec_helper"
|
21
|
+
require "chef/secret_fetcher"
|
22
|
+
require "chef/secret_fetcher/azure_key_vault"
|
23
|
+
|
24
|
+
describe Chef::SecretFetcher::AzureKeyVault do
|
25
|
+
let(:config) { { vault: "my_vault" } }
|
26
|
+
let(:fetcher) { Chef::SecretFetcher::AzureKeyVault.new(config, nil) }
|
27
|
+
|
28
|
+
context "when performing a fetch" do
|
29
|
+
let(:body) { '{ "value" : "my secret value" }' }
|
30
|
+
let(:response_mock) { double("response", body: body) }
|
31
|
+
let(:http_mock) { double("http", :get => response_mock, :use_ssl= => nil) }
|
32
|
+
|
33
|
+
before do
|
34
|
+
allow(fetcher).to receive(:fetch_token).and_return "a token"
|
35
|
+
allow(Net::HTTP).to receive(:new).and_return(http_mock)
|
36
|
+
end
|
37
|
+
|
38
|
+
context "and vault name is only provided in the secret name" do
|
39
|
+
let(:body) { '{ "value" : "my secret value" }' }
|
40
|
+
let(:config) { {} }
|
41
|
+
it "fetches the value" do
|
42
|
+
expect(fetcher.fetch("my_vault/value")).to eq "my secret value"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context "and vault name is not provided in the secret name" do
|
47
|
+
context "and vault name is not provided in config" do
|
48
|
+
let(:config) { {} }
|
49
|
+
it "raises a ConfigurationInvalid exception" do
|
50
|
+
expect { fetcher.fetch("value") }.to raise_error(Chef::Exceptions::Secret::ConfigurationInvalid)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
context "and vault name is provided in config" do
|
55
|
+
let(:config) { { vault: "my_vault" } }
|
56
|
+
it "fetches the value" do
|
57
|
+
expect(fetcher.fetch("value")).to eq "my secret value"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
context "and an error response is received in the body" do
|
62
|
+
let(:config) { { vault: "my_vault" } }
|
63
|
+
let(:body) { '{ "error" : { "code" : 404, "message" : "secret not found" } }' }
|
64
|
+
it "raises FetchFailed" do
|
65
|
+
expect { fetcher.fetch("value") }.to raise_error(Chef::Exceptions::Secret::FetchFailed)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
@@ -0,0 +1,82 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Marc Paradise <marc@chef.io>
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require "chef/secret_fetcher"
|
20
|
+
require "chef/secret_fetcher/example"
|
21
|
+
|
22
|
+
class SecretFetcherImpl < Chef::SecretFetcher::Base
|
23
|
+
def do_fetch(name, version)
|
24
|
+
name
|
25
|
+
end
|
26
|
+
|
27
|
+
def validate!; end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe Chef::SecretFetcher do
|
31
|
+
let(:fetcher_impl) { SecretFetcherImpl.new({}, nil) }
|
32
|
+
|
33
|
+
before do
|
34
|
+
allow(Chef::SecretFetcher::Example).to receive(:new).and_return fetcher_impl
|
35
|
+
end
|
36
|
+
|
37
|
+
context ".for_service" do
|
38
|
+
it "resolves the example fetcher without error" do
|
39
|
+
Chef::SecretFetcher.for_service(:example, {}, nil)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "resolves the Azure Key Vault fetcher without error" do
|
43
|
+
Chef::SecretFetcher.for_service(:azure_key_vault, { vault: "invalid" }, nil)
|
44
|
+
end
|
45
|
+
|
46
|
+
it "resolves the AWS fetcher without error" do
|
47
|
+
Chef::SecretFetcher.for_service(:aws_secrets_manager, { region: "invalid" }, nil)
|
48
|
+
end
|
49
|
+
|
50
|
+
it "raises Chef::Exceptions::Secret::MissingFetcher when service is blank" do
|
51
|
+
expect { Chef::SecretFetcher.for_service(nil, {}, nil) }.to raise_error(Chef::Exceptions::Secret::MissingFetcher)
|
52
|
+
end
|
53
|
+
|
54
|
+
it "raises Chef::Exceptions::Secret::MissingFetcher when service is nil" do
|
55
|
+
expect { Chef::SecretFetcher.for_service("", {}, nil) }.to raise_error(Chef::Exceptions::Secret::MissingFetcher)
|
56
|
+
end
|
57
|
+
|
58
|
+
it "raises Chef::Exceptions::Secret::InvalidFetcher for an unknown fetcher" do
|
59
|
+
expect { Chef::SecretFetcher.for_service(:bad_example, {}, nil) }.to raise_error(Chef::Exceptions::Secret::InvalidFetcherService)
|
60
|
+
end
|
61
|
+
|
62
|
+
it "ensures fetcher configuration is valid by invoking validate!" do
|
63
|
+
expect(fetcher_impl).to receive(:validate!)
|
64
|
+
Chef::SecretFetcher.for_service(:example, {}, nil)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context "#fetch" do
|
69
|
+
let(:fetcher) {
|
70
|
+
Chef::SecretFetcher.for_service(:example, { "key1" => "value1" }, nil)
|
71
|
+
}
|
72
|
+
|
73
|
+
it "fetches from the underlying service when secret name is provided " do
|
74
|
+
expect(fetcher_impl).to receive(:fetch).with("key1", "v1")
|
75
|
+
fetcher.fetch("key1", "v1")
|
76
|
+
end
|
77
|
+
|
78
|
+
it "raises an error when the secret name is not provided" do
|
79
|
+
expect { fetcher.fetch(nil) }.to raise_error(Chef::Exceptions::Secret::MissingSecretName)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
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.
|
4
|
+
version: 17.4.38
|
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: 2021-
|
11
|
+
date: 2021-08-27 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.
|
19
|
+
version: 17.4.38
|
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.
|
26
|
+
version: 17.4.38
|
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.
|
33
|
+
version: 17.4.38
|
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.
|
40
|
+
version: 17.4.38
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: train-core
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -440,6 +440,20 @@ dependencies:
|
|
440
440
|
- - "~>"
|
441
441
|
- !ruby/object:Gem::Version
|
442
442
|
version: '1.0'
|
443
|
+
- !ruby/object:Gem::Dependency
|
444
|
+
name: aws-sdk-secretsmanager
|
445
|
+
requirement: !ruby/object:Gem::Requirement
|
446
|
+
requirements:
|
447
|
+
- - "~>"
|
448
|
+
- !ruby/object:Gem::Version
|
449
|
+
version: '1.46'
|
450
|
+
type: :runtime
|
451
|
+
prerelease: false
|
452
|
+
version_requirements: !ruby/object:Gem::Requirement
|
453
|
+
requirements:
|
454
|
+
- - "~>"
|
455
|
+
- !ruby/object:Gem::Version
|
456
|
+
version: '1.46'
|
443
457
|
- !ruby/object:Gem::Dependency
|
444
458
|
name: win32-api
|
445
459
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1407,7 +1421,10 @@ files:
|
|
1407
1421
|
- lib/chef/dsl/reboot_pending.rb
|
1408
1422
|
- lib/chef/dsl/recipe.rb
|
1409
1423
|
- lib/chef/dsl/registry_helper.rb
|
1424
|
+
- lib/chef/dsl/render_helpers.rb
|
1410
1425
|
- lib/chef/dsl/resources.rb
|
1426
|
+
- lib/chef/dsl/secret.rb
|
1427
|
+
- lib/chef/dsl/toml.rb
|
1411
1428
|
- lib/chef/dsl/universal.rb
|
1412
1429
|
- lib/chef/encrypted_data_bag_item.rb
|
1413
1430
|
- lib/chef/encrypted_data_bag_item/assertions.rb
|
@@ -1460,6 +1477,7 @@ files:
|
|
1460
1477
|
- lib/chef/handler.rb
|
1461
1478
|
- lib/chef/handler/error_report.rb
|
1462
1479
|
- lib/chef/handler/json_file.rb
|
1480
|
+
- lib/chef/handler/slow_report.rb
|
1463
1481
|
- lib/chef/http.rb
|
1464
1482
|
- lib/chef/http/api_versions.rb
|
1465
1483
|
- lib/chef/http/auth_credentials.rb
|
@@ -1612,6 +1630,7 @@ files:
|
|
1612
1630
|
- lib/chef/provider/package/freebsd/base.rb
|
1613
1631
|
- lib/chef/provider/package/freebsd/pkgng.rb
|
1614
1632
|
- lib/chef/provider/package/freebsd/port.rb
|
1633
|
+
- lib/chef/provider/package/habitat.rb
|
1615
1634
|
- lib/chef/provider/package/homebrew.rb
|
1616
1635
|
- lib/chef/provider/package/ips.rb
|
1617
1636
|
- lib/chef/provider/package/macports.rb
|
@@ -1745,6 +1764,15 @@ files:
|
|
1745
1764
|
- lib/chef/resource/freebsd_package.rb
|
1746
1765
|
- lib/chef/resource/gem_package.rb
|
1747
1766
|
- lib/chef/resource/group.rb
|
1767
|
+
- lib/chef/resource/habitat/_habitat_shared.rb
|
1768
|
+
- lib/chef/resource/habitat/habitat_package.rb
|
1769
|
+
- lib/chef/resource/habitat/habitat_sup.rb
|
1770
|
+
- lib/chef/resource/habitat/habitat_sup_systemd.rb
|
1771
|
+
- lib/chef/resource/habitat/habitat_sup_windows.rb
|
1772
|
+
- lib/chef/resource/habitat_config.rb
|
1773
|
+
- lib/chef/resource/habitat_install.rb
|
1774
|
+
- lib/chef/resource/habitat_service.rb
|
1775
|
+
- lib/chef/resource/habitat_user_toml.rb
|
1748
1776
|
- lib/chef/resource/helpers/cron_validations.rb
|
1749
1777
|
- lib/chef/resource/homebrew_cask.rb
|
1750
1778
|
- lib/chef/resource/homebrew_package.rb
|
@@ -1815,11 +1843,13 @@ files:
|
|
1815
1843
|
- lib/chef/resource/solaris_package.rb
|
1816
1844
|
- lib/chef/resource/ssh_known_hosts_entry.rb
|
1817
1845
|
- lib/chef/resource/sudo.rb
|
1846
|
+
- lib/chef/resource/support/HabService.dll.config.erb
|
1818
1847
|
- lib/chef/resource/support/client.erb
|
1819
1848
|
- lib/chef/resource/support/cron.d.erb
|
1820
1849
|
- lib/chef/resource/support/cron_access.erb
|
1821
1850
|
- lib/chef/resource/support/ssh_known_hosts.erb
|
1822
1851
|
- lib/chef/resource/support/sudoer.erb
|
1852
|
+
- lib/chef/resource/support/sup.toml.erb
|
1823
1853
|
- lib/chef/resource/support/ulimit.erb
|
1824
1854
|
- lib/chef/resource/swap_file.rb
|
1825
1855
|
- lib/chef/resource/sysctl.rb
|
@@ -1839,6 +1869,8 @@ files:
|
|
1839
1869
|
- lib/chef/resource/windows_audit_policy.rb
|
1840
1870
|
- lib/chef/resource/windows_auto_run.rb
|
1841
1871
|
- lib/chef/resource/windows_certificate.rb
|
1872
|
+
- lib/chef/resource/windows_defender.rb
|
1873
|
+
- lib/chef/resource/windows_defender_exclusion.rb
|
1842
1874
|
- lib/chef/resource/windows_dfs_folder.rb
|
1843
1875
|
- lib/chef/resource/windows_dfs_namespace.rb
|
1844
1876
|
- lib/chef/resource/windows_dfs_server.rb
|
@@ -1863,6 +1895,7 @@ files:
|
|
1863
1895
|
- lib/chef/resource/windows_shortcut.rb
|
1864
1896
|
- lib/chef/resource/windows_task.rb
|
1865
1897
|
- lib/chef/resource/windows_uac.rb
|
1898
|
+
- lib/chef/resource/windows_update_settings.rb
|
1866
1899
|
- lib/chef/resource/windows_user_privilege.rb
|
1867
1900
|
- lib/chef/resource/windows_workgroup.rb
|
1868
1901
|
- lib/chef/resource/yum_package.rb
|
@@ -1894,6 +1927,11 @@ files:
|
|
1894
1927
|
- lib/chef/sandbox.rb
|
1895
1928
|
- lib/chef/scan_access_control.rb
|
1896
1929
|
- lib/chef/search/query.rb
|
1930
|
+
- lib/chef/secret_fetcher.rb
|
1931
|
+
- lib/chef/secret_fetcher/aws_secrets_manager.rb
|
1932
|
+
- lib/chef/secret_fetcher/azure_key_vault.rb
|
1933
|
+
- lib/chef/secret_fetcher/base.rb
|
1934
|
+
- lib/chef/secret_fetcher/example.rb
|
1897
1935
|
- lib/chef/server_api.rb
|
1898
1936
|
- lib/chef/server_api_versions.rb
|
1899
1937
|
- lib/chef/shell.rb
|
@@ -2444,7 +2482,9 @@ files:
|
|
2444
2482
|
- spec/functional/resource/windows_env_spec.rb
|
2445
2483
|
- spec/functional/resource/windows_firewall_rule_spec.rb
|
2446
2484
|
- spec/functional/resource/windows_font_spec.rb
|
2485
|
+
- spec/functional/resource/windows_hostname_spec.rb
|
2447
2486
|
- spec/functional/resource/windows_package_spec.rb
|
2487
|
+
- spec/functional/resource/windows_pagefile_spec.rb
|
2448
2488
|
- spec/functional/resource/windows_path_spec.rb
|
2449
2489
|
- spec/functional/resource/windows_security_policy_spec.rb
|
2450
2490
|
- spec/functional/resource/windows_share_spec.rb
|
@@ -2606,7 +2646,9 @@ files:
|
|
2606
2646
|
- spec/unit/dsl/reboot_pending_spec.rb
|
2607
2647
|
- spec/unit/dsl/recipe_spec.rb
|
2608
2648
|
- spec/unit/dsl/registry_helper_spec.rb
|
2649
|
+
- spec/unit/dsl/render_helpers_spec.rb
|
2609
2650
|
- spec/unit/dsl/resources_spec.rb
|
2651
|
+
- spec/unit/dsl/secret_spec.rb
|
2610
2652
|
- spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb
|
2611
2653
|
- spec/unit/encrypted_data_bag_item_spec.rb
|
2612
2654
|
- spec/unit/environment_spec.rb
|
@@ -2943,6 +2985,8 @@ files:
|
|
2943
2985
|
- spec/unit/resource/windows_audit_policy_spec.rb
|
2944
2986
|
- spec/unit/resource/windows_auto_run_spec.rb
|
2945
2987
|
- spec/unit/resource/windows_certificate_spec.rb
|
2988
|
+
- spec/unit/resource/windows_defender_exclusion_spec.rb
|
2989
|
+
- spec/unit/resource/windows_defender_spec.rb
|
2946
2990
|
- spec/unit/resource/windows_dfs_folder_spec.rb
|
2947
2991
|
- spec/unit/resource/windows_dfs_namespace_spec.rb
|
2948
2992
|
- spec/unit/resource/windows_dfs_server_spec.rb
|
@@ -2965,6 +3009,7 @@ files:
|
|
2965
3009
|
- spec/unit/resource/windows_shortcut_spec.rb
|
2966
3010
|
- spec/unit/resource/windows_task_spec.rb
|
2967
3011
|
- spec/unit/resource/windows_uac_spec.rb
|
3012
|
+
- spec/unit/resource/windows_update_settings_spec.rb
|
2968
3013
|
- spec/unit/resource/windows_user_privilege_spec.rb
|
2969
3014
|
- spec/unit/resource/windows_workgroup_spec.rb
|
2970
3015
|
- spec/unit/resource/yum_package_spec.rb
|
@@ -2994,6 +3039,9 @@ files:
|
|
2994
3039
|
- spec/unit/runner_spec.rb
|
2995
3040
|
- spec/unit/scan_access_control_spec.rb
|
2996
3041
|
- spec/unit/search/query_spec.rb
|
3042
|
+
- spec/unit/secret_fetcher/aws_secrets_manager_spec.rb
|
3043
|
+
- spec/unit/secret_fetcher/azure_key_vault_spec.rb
|
3044
|
+
- spec/unit/secret_fetcher_spec.rb
|
2997
3045
|
- spec/unit/server_api_spec.rb
|
2998
3046
|
- spec/unit/server_api_versions_spec.rb
|
2999
3047
|
- spec/unit/shell/model_wrapper_spec.rb
|
@@ -3050,7 +3098,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
3050
3098
|
- !ruby/object:Gem::Version
|
3051
3099
|
version: '0'
|
3052
3100
|
requirements: []
|
3053
|
-
rubygems_version: 3.2.
|
3101
|
+
rubygems_version: 3.2.22
|
3054
3102
|
signing_key:
|
3055
3103
|
specification_version: 4
|
3056
3104
|
summary: A systems integration framework, built to bring the benefits of configuration
|