summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRanjib Dey <ranjib@linux.com>2015-08-27 23:28:21 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2015-10-24 18:34:53 -0700
commit484e7e5bcf068714be69f98d412b0c10b9edc20a (patch)
tree3677d55b1f084bd0e87f3206de34dc8dc6cc931b
parent349bc2b26772dd02bda97089c09733db8235f0d2 (diff)
downloadchef-484e7e5bcf068714be69f98d412b0c10b9edc20a.tar.gz
dont spit out stdout and stderr for execute resource failure, if its declared sensitive
-rw-r--r--lib/chef/provider/execute.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/chef/provider/execute.rb b/lib/chef/provider/execute.rb
index c3dd3b4ee1..67e5bfa842 100644
--- a/lib/chef/provider/execute.rb
+++ b/lib/chef/provider/execute.rb
@@ -58,7 +58,16 @@ class Chef
end
converge_by("execute #{description}") do
- result = shell_out!(command, opts)
+ begin
+ shell_out!(command, opts)
+ rescue Mixlib::ShellOut::ShellCommandFailed => e
+ if sensitive?
+ raise Mixlib::ShellOut::ShellCommandFailed,
+ "Command execution failed. STDOUT/STDERR suppressed for sensitive resource"
+ else
+ raise e
+ end
+ end
Chef::Log.info("#{new_resource} ran successfully")
end
end