summaryrefslogtreecommitdiff
path: root/lib/chef/audit
diff options
context:
space:
mode:
authorClaire McQuin <claire@getchef.com>2015-05-19 17:11:10 -0700
committerBryan McLellan <btm@loftninjas.org>2015-05-27 14:16:29 -0400
commit166a6db885fe988c71c403c7f22c1d7b1189830a (patch)
treeafac877636e49f3f2dcc146de142d4724c48e646 /lib/chef/audit
parentdd89bd93841acf8aa64a9dc21f64e09d2fe7b762 (diff)
downloadchef-166a6db885fe988c71c403c7f22c1d7b1189830a.tar.gz
remove configuration option
Diffstat (limited to 'lib/chef/audit')
-rw-r--r--lib/chef/audit/audit_reporter.rb18
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/chef/audit/audit_reporter.rb b/lib/chef/audit/audit_reporter.rb
index 030ae34201..fd3d13dd89 100644
--- a/lib/chef/audit/audit_reporter.rb
+++ b/lib/chef/audit/audit_reporter.rb
@@ -72,7 +72,9 @@ class Chef
end
def run_failed(error)
- post_auditing_data(error)
+ # Audit phase errors are captured when audit_phase_failed gets called.
+ # The error passed here isn't relevant to auditing, so we ignore it.
+ post_auditing_data
end
def control_group_started(name)
@@ -100,7 +102,7 @@ class Chef
private
- def post_auditing_data(error = nil)
+ def post_auditing_data
unless auditing_enabled?
Chef::Log.debug("Audit Reports are disabled. Skipping sending reports.")
return
@@ -118,14 +120,10 @@ class Chef
Chef::Log.debug("Sending audit report (run-id: #{audit_data.run_id})")
run_data = audit_data.to_hash
- if @exception || error
- errors = [@exception, error].uniq.compact
- errors_messages = errors.map do |err|
- msg = "#{err.class.to_s}: #{err.message}"
- msg << "\n#{err.backtrace.join("\n")}" if err.backtrace
- msg
- end
- run_data[:error] = errors_messages.join("\n")
+ if @exception
+ error_info = "#{@exception.class}: #{@exception.message}"
+ error_info << "\n#{@exception.backtrace.join("\n")}" if @exception.backtrace
+ run_data[:error] = error_info
end
Chef::Log.debug "Audit Report:\n#{Chef::JSONCompat.to_json_pretty(run_data)}"