summaryrefslogtreecommitdiff
path: root/lib/chef/resource
diff options
context:
space:
mode:
authorNoah Kantrowitz <noah@coderanger.net>2016-04-04 16:50:05 -0400
committerThom May <thom@chef.io>2017-12-18 19:28:04 +0000
commit3b97e4a703356394a799677723a27432103ee611 (patch)
treef176a50c6d1715a9f5608148c4bcf2ae033ed4c0 /lib/chef/resource
parentabdfb00bac4cf6c920462afe8dd3d6f86ad5d974 (diff)
downloadchef-3b97e4a703356394a799677723a27432103ee611.tar.gz
Slight improvements to validation failures. Shows the failing command if possible and doesn't show anything for sensitive resources to be safe.
Refs https://github.com/chef/chef/issues/4793 and ping @chef/client-core for review.
Diffstat (limited to 'lib/chef/resource')
-rw-r--r--lib/chef/resource/file/verification.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/chef/resource/file/verification.rb b/lib/chef/resource/file/verification.rb
index 079e6dc201..cfbdfd5263 100644
--- a/lib/chef/resource/file/verification.rb
+++ b/lib/chef/resource/file/verification.rb
@@ -119,6 +119,16 @@ class Chef
v = verification_class.new(@parent_resource, @command, @command_opts, &@block)
v.verify(path, opts)
end
+
+ def to_s
+ if @block
+ '<Proc>'
+ elsif @command.is_a?(Symbol)
+ "#{@command.inspect} (#{Chef::Resource::File::Verification.lookup(@command).name})"
+ elsif @command.is_a?(String)
+ @command
+ end
+ end
end
end
end