summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2021-09-07 06:29:25 -0700
committerGitHub <noreply@github.com>2021-09-07 06:29:25 -0700
commit59400ddc3cd5c70650f93aaf0b2d47274d98a79b (patch)
treee4297f1233d4be68ae2943d23ef9686eaffb2a2c
parentb91d99f16947b82d09217079f5423b5c7cd0962c (diff)
parent0eef761651b41cac71f229e793c5722b2b508db2 (diff)
downloadchef-59400ddc3cd5c70650f93aaf0b2d47274d98a79b.tar.gz
Merge pull request #12000 from chef/11892_user_ulimit_resource_sensitive_true
ulimit: Fix sensitive property
-rw-r--r--lib/chef/resource/user_ulimit.rb1
-rw-r--r--spec/unit/resource/user_ulimit_spec.rb15
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/chef/resource/user_ulimit.rb b/lib/chef/resource/user_ulimit.rb
index 55331dfc1c..594b585dbf 100644
--- a/lib/chef/resource/user_ulimit.rb
+++ b/lib/chef/resource/user_ulimit.rb
@@ -83,6 +83,7 @@ class Chef
source ::File.expand_path("support/ulimit.erb", __dir__)
local true
mode "0644"
+ sensitive new_resource.sensitive
variables(
ulimit_user: new_resource.username,
filehandle_limit: new_resource.filehandle_limit,
diff --git a/spec/unit/resource/user_ulimit_spec.rb b/spec/unit/resource/user_ulimit_spec.rb
index f451870ac1..7acd9239a5 100644
--- a/spec/unit/resource/user_ulimit_spec.rb
+++ b/spec/unit/resource/user_ulimit_spec.rb
@@ -17,7 +17,6 @@
#
require "spec_helper"
-
describe Chef::Resource::UserUlimit do
let(:node) { Chef::Node.new }
let(:events) { Chef::EventDispatch::Dispatcher.new }
@@ -50,4 +49,18 @@ describe Chef::Resource::UserUlimit do
expect { resource.action :create }.not_to raise_error
expect { resource.action :delete }.not_to raise_error
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