summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Snow <thelunaticscripter@outlook.com>2017-06-12 18:24:56 -0500
committerThom May <thom@chef.io>2018-03-22 11:10:49 +0000
commit14708e1afa4ebcaa031e3a813cecf57932982e7b (patch)
treeb73c5feec328de32931c50328219f1080e215559
parentfd5892d508845cb5388b87fd2e975f594aaa7d45 (diff)
downloadchef-14708e1afa4ebcaa031e3a813cecf57932982e7b.tar.gz
Prevent shelled out command from execute resource
Changes: - Revert proposed unless and instead incorporate proposed changes suggested by reviewers Signed-off-by: John Snow <thelunaticscripter@outlook.com>
-rw-r--r--lib/chef/application.rb12
-rw-r--r--lib/chef/provider/execute.rb1
2 files changed, 6 insertions, 7 deletions
diff --git a/lib/chef/application.rb b/lib/chef/application.rb
index 974b80423c..b66268e9f9 100644
--- a/lib/chef/application.rb
+++ b/lib/chef/application.rb
@@ -360,14 +360,12 @@ class Chef
def debug_stacktrace(e)
message = "#{e.class}: #{e}\n#{e.backtrace.join("\n")}"
- unless e.message =~ /suppressed for sensitive resource/
- cause = e.cause if e.respond_to?(:cause)
- until cause.nil?
- message << "\n\n>>>> Caused by #{cause.class}: #{cause}\n#{cause.backtrace.join("\n")}"
- cause = cause.respond_to?(:cause) ? cause.cause : nil
- end
+ cause = e.cause if e.respond_to?(:cause)
+ until cause.nil?
+ message << "\n\n>>>> Caused by #{cause.class}: #{cause}\n#{cause.backtrace.join("\n")}"
+ cause = cause.respond_to?(:cause) ? cause.cause : nil
end
-
+
chef_stacktrace_out = "Generated at #{Time.now}\n"
chef_stacktrace_out += message
diff --git a/lib/chef/provider/execute.rb b/lib/chef/provider/execute.rb
index d5a0bdfa11..11c84eaf9e 100644
--- a/lib/chef/provider/execute.rb
+++ b/lib/chef/provider/execute.rb
@@ -58,6 +58,7 @@ 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"
else