diff options
author | Thom May <thom@may.lt> | 2017-12-19 09:45:43 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-19 09:45:43 +0000 |
commit | f13388dca743d20cbae5051ba2b7a4a182ed8e5b (patch) | |
tree | 848c20c17586e8e4e2bf0181e9f3b842ae64a117 /lib | |
parent | f61f8bb75fcc0ba934b688c34f8d018bfcb3ca81 (diff) | |
parent | b4690c58ae034207ddcbb8625e066f5327930f97 (diff) | |
download | chef-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.rb | 2 | ||||
-rw-r--r-- | lib/chef/resource/file/verification.rb | 10 |
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 |