summaryrefslogtreecommitdiff
path: root/chef/lib
diff options
context:
space:
mode:
authorLamont Granquist <lamont@opscode.com>2012-10-04 13:59:39 -0700
committerLamont Granquist <lamont@opscode.com>2012-10-05 10:32:38 -0700
commit05eb8b28a338cd96488d8c56cfaa4755c52d6f3f (patch)
tree38c9ead5e1364a527cf7fc35b5c8a12be09efb34 /chef/lib
parent2566b021e05eb90b05de413c57ced218d896dc0f (diff)
downloadchef-05eb8b28a338cd96488d8c56cfaa4755c52d6f3f.tar.gz
ignore 500s returned by the reporting url if the service is down.
Diffstat (limited to 'chef/lib')
-rw-r--r--chef/lib/chef/config.rb1
-rw-r--r--chef/lib/chef/resource_reporter.rb12
2 files changed, 11 insertions, 2 deletions
diff --git a/chef/lib/chef/config.rb b/chef/lib/chef/config.rb
index 8ad0648eec..e16d301c3b 100644
--- a/chef/lib/chef/config.rb
+++ b/chef/lib/chef/config.rb
@@ -202,6 +202,7 @@ class Chef
color false
client_fork false
enable_reporting true
+ enable_reporting_url_fatals false
# Set these to enable SSL authentication / mutual-authentication
# with the server
diff --git a/chef/lib/chef/resource_reporter.rb b/chef/lib/chef/resource_reporter.rb
index c643729dd0..e9c7f63634 100644
--- a/chef/lib/chef/resource_reporter.rb
+++ b/chef/lib/chef/resource_reporter.rb
@@ -116,8 +116,16 @@ class Chef
Chef::Log.info("Chef server generated run history id: #{@run_id}")
@summary_only = server_response["summary_only"]
rescue Net::HTTPServerException => e
- raise unless e.response.code.to_s == "404"
- Chef::Log.debug("Received 404 attempting to generate run history id (URL Path: #{resource_history_url}), assuming feature is not supported.")
+ if e.response.code.to_s == "404"
+ Chef::Log.debug("Received 404 attempting to generate run history id (URL Path: #{resource_history_url}), assuming feature is not supported.")
+ else
+ if Chef::Config[:enable_reporting_url_fatals]
+ Chef::Log.error("Received #{e.response.code} attempting to generate run history id (URL Path: #{resource_history_url}), and enable_reporting_url_fatals is set, aborting run.")
+ raise
+ else
+ Chef::Log.info("Received #{e.response.code} attempting to generate run history id (URL Path: #{resource_history_url}), disabling reporting for this run.")
+ end
+ end
@reporting_enabled = false
end
end