diff options
author | Noah Kantrowitz <noah@coderanger.net> | 2017-06-13 15:41:45 -0700 |
---|---|---|
committer | Thom May <thom@chef.io> | 2018-03-22 11:10:50 +0000 |
commit | 7354ffb870dbc39cda29f8caed3211491323899f (patch) | |
tree | 24944fce7dd1d79880bb470f2409e4a7cacf407c | |
parent | 87247ca010af724763efb8e1817f5d67009c6608 (diff) | |
download | chef-7354ffb870dbc39cda29f8caed3211491323899f.tar.gz |
Use a better (read: working) technique because I was totally wrong about $!.pr-6203
Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
-rw-r--r-- | lib/chef/provider/execute.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/chef/provider/execute.rb b/lib/chef/provider/execute.rb index 11c84eaf9e..0e9acb4028 100644 --- a/lib/chef/provider/execute.rb +++ b/lib/chef/provider/execute.rb @@ -58,9 +58,12 @@ class Chef shell_out_with_systems_locale!(command, opts) rescue Mixlib::ShellOut::ShellCommandFailed if sensitive? - $! = nil - raise Mixlib::ShellOut::ShellCommandFailed, - "Command execution failed. STDOUT/STDERR suppressed for sensitive resource" + ex = Mixlib::ShellOut::ShellCommandFailed.new("Command execution failed. STDOUT/STDERR suppressed for sensitive resource") + # Forcibly hide the exception cause chain here so we don't log the unredacted version + def ex.cause + nil + end + raise ex else raise end |