summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/mixin/properties.rb6
-rw-r--r--lib/chef/resource.rb2
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/chef/mixin/properties.rb b/lib/chef/mixin/properties.rb
index c42e3889b0..4e00a09002 100644
--- a/lib/chef/mixin/properties.rb
+++ b/lib/chef/mixin/properties.rb
@@ -274,6 +274,12 @@ class Chef
result
end
+ # This method returns list of sensitive properties
+ # @return [Array<Property>] All sensitive properties.
+ def sensitive_properties
+ properties.values.empty? ? [] : properties.values.select(&:sensitive?)
+ end
+
# Returns the name of the name property. Returns nil if there is no name property.
#
# @return [Symbol] the name property for this resource
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb
index d6c5fe7cdf..c9776fe346 100644
--- a/lib/chef/resource.rb
+++ b/lib/chef/resource.rb
@@ -660,8 +660,8 @@ class Chef
text << "#{resource_name}(\"#{name}\") do\n"
all_props = {}
- self.class.state_properties.map do |p|
+ self.class.sensitive_properties.map do |p|
all_props[p.name.to_s] = p.sensitive? ? '"*sensitive value suppressed*"' : value_to_text(p.get(self))
rescue Chef::Exceptions::ValidationFailed
# This space left intentionally blank, the property was probably required or had an invalid default.