summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortyler-ball <tyleraball@gmail.com>2014-11-12 13:07:52 -0800
committertyler-ball <tyleraball@gmail.com>2014-11-12 13:07:52 -0800
commitf5b36609eeb85d060e61293678488490cd382ea1 (patch)
tree33dba33de25e843e010c179e05630faec3068d89
parente334dd999acb79a56f78a5bcc156e4f5a67c646e (diff)
parent5e1eea3baaade28415d8a74bfd407d461be2240c (diff)
downloadchef-f5b36609eeb85d060e61293678488490cd382ea1.tar.gz
Merge branch 'audit-mode' into tball/audit-tests
-rw-r--r--lib/chef/audit/audit_reporter.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/chef/audit/audit_reporter.rb b/lib/chef/audit/audit_reporter.rb
index 6cbab82acb..b1c9d30bfc 100644
--- a/lib/chef/audit/audit_reporter.rb
+++ b/lib/chef/audit/audit_reporter.rb
@@ -57,7 +57,11 @@ class Chef
# that runs tests - normal errors are interpreted as EXAMPLE failures and captured.
def audit_phase_failed(error)
# The stacktrace information has already been logged elsewhere
- Chef::Log.error("Audit Reporter failed - not sending any auditing information to the server")
+ Chef::Log.error("Audit Reporter failed - sending error to server with available example information")
+ ordered_control_groups.each do |name, control_group|
+ audit_data.add_control_group(control_group)
+ end
+ post_auditing_data(error)
end
def control_group_started(name)
@@ -83,11 +87,16 @@ class Chef
private
- def post_auditing_data
+ def post_auditing_data(error = nil)
if auditing_enabled?
audit_history_url = "controls"
Chef::Log.info("Sending audit report (run-id: #{audit_data.run_id})")
run_data = audit_data.to_hash
+
+ if error
+ run_data[:error] = "#{error.class.to_s}: #{error.message}\n#{error.backtrace.join("\n")}"
+ end
+
Chef::Log.debug run_data.inspect
compressed_data = encode_gzip(Chef::JSONCompat.to_json(run_data))
Chef::Log.debug("Sending compressed audit data...")