summaryrefslogtreecommitdiff
path: root/lib/chef/resource_reporter.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/resource_reporter.rb')
-rw-r--r--lib/chef/resource_reporter.rb14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/chef/resource_reporter.rb b/lib/chef/resource_reporter.rb
index 19964c24cf..04fd00c103 100644
--- a/lib/chef/resource_reporter.rb
+++ b/lib/chef/resource_reporter.rb
@@ -25,7 +25,6 @@ require "chef/event_dispatch/base"
class Chef
class ResourceReporter < EventDispatch::Base
-
class ResourceReport < Struct.new(:new_resource,
:current_resource,
:action,
@@ -121,8 +120,8 @@ class Chef
if reporting_enabled?
begin
resource_history_url = "reports/nodes/#{node_name}/runs"
- server_response = @rest_client.post(resource_history_url, {:action => :start, :run_id => run_id,
- :start_time => start_time.to_s}, headers)
+ 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)
end
@@ -232,7 +231,7 @@ class Chef
Chef::Log.debug("Sending compressed run data...")
# Since we're posting compressed data we can not directly call post which expects JSON
begin
- @rest_client.raw_request(:POST, resource_history_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)
@@ -247,7 +246,7 @@ class Chef
end
def headers(additional_headers = {})
- options = {"X-Ops-Reporting-Protocol-Version" => PROTOCOL_VERSION}
+ options = { "X-Ops-Reporting-Protocol-Version" => PROTOCOL_VERSION }
options.merge(additional_headers)
end
@@ -282,7 +281,7 @@ class Chef
exception_data["class"] = exception.inspect
exception_data["message"] = exception.message
exception_data["backtrace"] = Chef::JSONCompat.to_json(exception.backtrace)
- exception_data["description"] = @error_descriptions
+ exception_data["description"] = @error_descriptions
run_data["data"]["exception"] = exception_data
end
run_data
@@ -319,9 +318,8 @@ class Chef
def encode_gzip(data)
"".tap do |out|
- Zlib::GzipWriter.wrap(StringIO.new(out)){|gz| gz << data }
+ Zlib::GzipWriter.wrap(StringIO.new(out)) { |gz| gz << data }
end
end
-
end
end