diff options
author | Thom May <thom@chef.io> | 2015-12-02 12:19:33 +0000 |
---|---|---|
committer | Thom May <thom@chef.io> | 2016-01-11 15:40:42 +0000 |
commit | d99e306a41b1402209d320cb7119b12a3bbb962f (patch) | |
tree | f65940702826deb991e6198967d3e9e96cb2857a /lib/chef/resource_reporter.rb | |
parent | 1b71aeb423b009f6d1a44215c89e9976957b47e9 (diff) | |
download | chef-d99e306a41b1402209d320cb7119b12a3bbb962f.tar.gz |
Convert all uses of Chef::REST to Chef::ServerAPItm/no_more_rest
In the process, stop auto-expanding JSON in the HTTP client, and let
individual classes control that themselves.
Fixes #2737, Fixes #3518
Diffstat (limited to 'lib/chef/resource_reporter.rb')
-rw-r--r-- | lib/chef/resource_reporter.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/chef/resource_reporter.rb b/lib/chef/resource_reporter.rb index 1175b0afb3..e2c71f7bd5 100644 --- a/lib/chef/resource_reporter.rb +++ b/lib/chef/resource_reporter.rb @@ -121,7 +121,7 @@ class Chef if reporting_enabled? begin resource_history_url = "reports/nodes/#{node_name}/runs" - server_response = @rest_client.post_rest(resource_history_url, {:action => :start, :run_id => run_id, + server_response = @rest_client.post(resource_history_url, {:action => :start, :run_id => run_id, :start_time => start_time.to_s}, headers) rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e handle_error_starting_run(e, resource_history_url) @@ -230,10 +230,9 @@ class Chef Chef::Log.debug run_data.inspect compressed_data = encode_gzip(Chef::JSONCompat.to_json(run_data)) Chef::Log.debug("Sending compressed run data...") - # 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) + # Since we're posting compressed data we can not directly call post which expects JSON begin - @rest_client.raw_http_request(:POST, reporting_url, headers({'Content-Encoding' => 'gzip'}), compressed_data) + @rest_client.raw_request(:POST, resource_history_url, headers({'Content-Encoding' => 'gzip'}), compressed_data) rescue StandardError => e if e.respond_to? :response Chef::FileCache.store("failed-reporting-data.json", Chef::JSONCompat.to_json_pretty(run_data), 0640) |