summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authortyler-ball <tyleraball@gmail.com>2014-11-12 12:53:52 -0800
committertyler-ball <tyleraball@gmail.com>2014-12-17 18:50:10 -0800
commit8efee3e8ed41dc7cd4ae0b4a1664467dd403346d (patch)
tree6c3d333fe0202908a30a771c44d709ee12c23bef /lib
parentc6732b92c8b501800c9009dd2f4d04042f9bca9c (diff)
downloadchef-8efee3e8ed41dc7cd4ae0b4a1664467dd403346d.tar.gz
Adding uncaught error information
Diffstat (limited to 'lib')
-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...")