summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Shestoperov <dmitry@shestoperov.info>2017-09-26 21:31:54 -0400
committerDmitry Shestoperov <dmitry@shestoperov.info>2017-09-26 21:31:54 -0400
commita01b8a5eecb33e72cf3f266eb31ad8773b0dd65a (patch)
treedf930458873faeecc14acc8b326cffac0220cd04
parent48031f02cfe9aec08ab0e783b658da89060f05c3 (diff)
downloadchef-a01b8a5eecb33e72cf3f266eb31ad8773b0dd65a.tar.gz
password property of mount resurce is sensitive
Signed-off-by: Dmitry Shestoperov <dmitry@shestoperov.info>
-rw-r--r--lib/chef/resource/mount.rb11
-rw-r--r--spec/unit/resource/mount_spec.rb2
2 files changed, 4 insertions, 9 deletions
diff --git a/lib/chef/resource/mount.rb b/lib/chef/resource/mount.rb
index 7e601b861a..6ea37d760f 100644
--- a/lib/chef/resource/mount.rb
+++ b/lib/chef/resource/mount.rb
@@ -34,6 +34,8 @@ class Chef
property :supports, Hash, default: lazy { { remount: false } },
coerce: proc { |x| x.is_a?(Array) ? x.each_with_object({}) { |i, m| m[i] = true } : x }
+ property :password, String, sensitive: true
+
def initialize(name, run_context = nil)
super
@mount_point = name
@@ -147,14 +149,7 @@ class Chef
set_or_return(
:username,
arg,
- :kind_of => [ String ]
- )
- end
-
- def password(arg = nil)
- set_or_return(
- :password,
- arg,
+ :sensitive => true,
:kind_of => [ String ]
)
end
diff --git a/spec/unit/resource/mount_spec.rb b/spec/unit/resource/mount_spec.rb
index 466b6ac8c0..caa2e2f65a 100644
--- a/spec/unit/resource/mount_spec.rb
+++ b/spec/unit/resource/mount_spec.rb
@@ -205,7 +205,7 @@ describe Chef::Resource::Mount do
state = @resource.state_for_resource_reporter
expect(state[:mount_point]).to eq("T:")
expect(state[:username]).to eq("Administrator")
- expect(state[:password]).to eq("Jetstream123!")
+ expect(state[:password]).to eq("*sensitive value suppressed*")
expect(state[:domain]).to eq("TEST_DOMAIN")
expect(state[:device_type]).to eql(:device)
expect(state[:fstype]).to eq("auto")