summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom May <thom@may.lt>2018-03-22 19:27:15 +0000
committerGitHub <noreply@github.com>2018-03-22 19:27:15 +0000
commitcd8885b42461f7c95f467d0f7c03dcafe9235d02 (patch)
tree720b28013e21ed0f06f64850110fab110e855845
parenta62033932661d7dbcc14983cf07dd55977d15063 (diff)
parent7354ffb870dbc39cda29f8caed3211491323899f (diff)
downloadchef-cd8885b42461f7c95f467d0f7c03dcafe9235d02.tar.gz
Merge pull request #7032 from chef/pr-6203
Suppress nested causes for sensitive exceptions
-rw-r--r--lib/chef/provider/execute.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/chef/provider/execute.rb b/lib/chef/provider/execute.rb
index d5a0bdfa11..0e9acb4028 100644
--- a/lib/chef/provider/execute.rb
+++ b/lib/chef/provider/execute.rb
@@ -58,8 +58,12 @@ class Chef
shell_out_with_systems_locale!(command, opts)
rescue Mixlib::ShellOut::ShellCommandFailed
if sensitive?
- 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