summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorThom May <thom@may.lt>2017-12-19 09:45:43 +0000
committerGitHub <noreply@github.com>2017-12-19 09:45:43 +0000
commitf13388dca743d20cbae5051ba2b7a4a182ed8e5b (patch)
tree848c20c17586e8e4e2bf0181e9f3b842ae64a117 /lib
parentf61f8bb75fcc0ba934b688c34f8d018bfcb3ca81 (diff)
parentb4690c58ae034207ddcbb8625e066f5327930f97 (diff)
downloadchef-f13388dca743d20cbae5051ba2b7a4a182ed8e5b.tar.gz
Merge pull request #6690 from chef/tm+nk/verify-command
Slight improvements to validation failures
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/provider/file.rb2
-rw-r--r--lib/chef/resource/file/verification.rb10
2 files changed, 11 insertions, 1 deletions
diff --git a/lib/chef/provider/file.rb b/lib/chef/provider/file.rb
index fea77dd7ea..86e7e5a5c4 100644
--- a/lib/chef/provider/file.rb
+++ b/lib/chef/provider/file.rb
@@ -339,7 +339,7 @@ class Chef
if tempfile
new_resource.verify.each do |v|
if ! v.verify(tempfile.path)
- raise Chef::Exceptions::ValidationFailed.new "Proposed content for #{new_resource.path} failed verification #{v}"
+ raise Chef::Exceptions::ValidationFailed.new "Proposed content for #{new_resource.path} failed verification #{new_resource.sensitive ? '[sensitive]' : v}"
end
end
end
diff --git a/lib/chef/resource/file/verification.rb b/lib/chef/resource/file/verification.rb
index 079e6dc201..ed6fce2e5c 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