diff options
Diffstat (limited to 'chef/lib')
-rw-r--r-- | chef/lib/chef/config.rb | 1 | ||||
-rw-r--r-- | chef/lib/chef/resource_reporter.rb | 12 |
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 |