summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJared Kauppila <Jared.Kauppila@sentry.com>2021-10-26 10:06:31 -0500
committerTim Smith <tsmith84@gmail.com>2021-10-27 12:41:27 -0700
commit3123f9d75aa05d5aaacc542dda6af5723f4a597f (patch)
treed826cf3ec4fd924bd33e0d047a40357873cae326
parentd61840ae9c1d0e089e927b2761242bdf219e61cc (diff)
downloadchef-3123f9d75aa05d5aaacc542dda6af5723f4a597f.tar.gz
Add support for `sensitive` in `chef_client_trusted_certificate`trusted_16
Signed-off-by: Jared Kauppila <Jared.Kauppila@sentry.com>
-rw-r--r--lib/chef/resource/chef_client_trusted_certificate.rb1
-rw-r--r--spec/unit/resource/chef_client_trusted_certificate_spec.rb14
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/chef/resource/chef_client_trusted_certificate.rb b/lib/chef/resource/chef_client_trusted_certificate.rb
index b5272fbe01..356490d350 100644
--- a/lib/chef/resource/chef_client_trusted_certificate.rb
+++ b/lib/chef/resource/chef_client_trusted_certificate.rb
@@ -75,6 +75,7 @@ class Chef
file cert_path do
content new_resource.certificate
mode "0640"
+ sensitive new_resource.sensitive
end
end
diff --git a/spec/unit/resource/chef_client_trusted_certificate_spec.rb b/spec/unit/resource/chef_client_trusted_certificate_spec.rb
index 558e737555..66f8ebe682 100644
--- a/spec/unit/resource/chef_client_trusted_certificate_spec.rb
+++ b/spec/unit/resource/chef_client_trusted_certificate_spec.rb
@@ -51,4 +51,18 @@ describe Chef::Resource::ChefClientTrustedCertificate do
expect(provider.cert_path).to match(%r{trusted_certs/something.pem$})
end
end
+
+ describe "sensitive attribute" do
+ context "should be insensitive by default" do
+ it { expect(resource.sensitive).to(be_falsey) }
+ end
+
+ context "when set" do
+ before { resource.sensitive(true) }
+
+ it "should be set on the resource" do
+ expect(resource.sensitive).to(be_truthy)
+ end
+ end
+ end
end