summaryrefslogtreecommitdiff
path: root/lib/chef/resource_reporter.rb
diff options
context:
space:
mode:
authorHugo Lopes Tavares <hltbra@gmail.com>2014-06-25 14:00:32 -0400
committerHugo Lopes Tavares <hltbra@gmail.com>2014-06-25 14:00:32 -0400
commita29da10fdfde1f3aacf3ec2b0f2b23c1193a185b (patch)
tree2a3237b78171e76c875ad0aa240bf7f56daa411a /lib/chef/resource_reporter.rb
parent7bd5fa322e6bb75aad596ccfde04fac49dc84cf4 (diff)
downloadchef-a29da10fdfde1f3aacf3ec2b0f2b23c1193a185b.tar.gz
Fix ResourceReporter#post_reporting_data http error handling. Fixes #1550
Diffstat (limited to 'lib/chef/resource_reporter.rb')
-rw-r--r--lib/chef/resource_reporter.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/chef/resource_reporter.rb b/lib/chef/resource_reporter.rb
index 47bbd13741..8f6d66cd5d 100644
--- a/lib/chef/resource_reporter.rb
+++ b/lib/chef/resource_reporter.rb
@@ -236,7 +236,8 @@ class Chef
# Since we're posting compressed data we can not directly call post_rest which expects JSON
reporting_url = @rest_client.create_url(resource_history_url)
@rest_client.raw_http_request(:POST, reporting_url, headers({'Content-Encoding' => 'gzip'}), compressed_data)
- rescue Net::HTTPServerException => e
+ rescue StandardError => e
+ raise if !e.respond_to? :response
if e.response.code.to_s == "400"
Chef::FileCache.store("failed-reporting-data.json", Chef::JSONCompat.to_json_pretty(run_data), 0640)
Chef::Log.error("Failed to post reporting data to server (HTTP 400), saving to #{Chef::FileCache.load("failed-reporting-data.json", false)}")