diff options
author | Bapu L <bapu.labade@progress.com> | 2022-06-21 14:14:24 +0530 |
---|---|---|
committer | Bapu L <bapu.labade@progress.com> | 2022-06-21 14:14:24 +0530 |
commit | e8086d2733311a17d37698bc6e9d6bdaa2b96068 (patch) | |
tree | 4d633f6d2815979aa881c51713f5f767d350b1f3 /lib/chef | |
parent | 9894e49919e40798b6830720110fe99166b969bf (diff) | |
download | chef-e8086d2733311a17d37698bc6e9d6bdaa2b96068.tar.gz |
Property values should be suppressed irrespective of desired state
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/mixin/properties.rb | 6 | ||||
-rw-r--r-- | lib/chef/resource.rb | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/chef/mixin/properties.rb b/lib/chef/mixin/properties.rb index c42e3889b0..89cca2abac 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 identity 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. |