summaryrefslogtreecommitdiff
path: root/lib/chef/resource_reporter.rb
diff options
context:
space:
mode:
authormmzyk <mmzyk@opscode.com>2013-04-01 16:37:35 -0400
committerBryan McLellan <btm@opscode.com>2013-06-18 08:58:18 -0700
commit155085fd687de2ca5e3e00172b9a4c089f933e97 (patch)
tree799a78615aedcd0c2ebefc32f37c037b816c9253 /lib/chef/resource_reporter.rb
parent81a6c19e402f71336dc4f1c6bfcf439c74c426cf (diff)
downloadchef-155085fd687de2ca5e3e00172b9a4c089f933e97.tar.gz
[OC-6938] Remove summary mode from the client
remove summary-only rspec tests
Diffstat (limited to 'lib/chef/resource_reporter.rb')
-rw-r--r--lib/chef/resource_reporter.rb35
1 files changed, 9 insertions, 26 deletions
diff --git a/lib/chef/resource_reporter.rb b/lib/chef/resource_reporter.rb
index f9ad5e1cb9..0916313b73 100644
--- a/lib/chef/resource_reporter.rb
+++ b/lib/chef/resource_reporter.rb
@@ -85,7 +85,6 @@ class Chef
attr_reader :exception
attr_reader :run_id
attr_reader :error_descriptions
- attr_reader :summary_only
def initialize(rest_client)
if Chef::Config[:enable_reporting] && !Chef::Config[:why_run]
@@ -102,7 +101,6 @@ class Chef
@rest_client = rest_client
@node = nil
@error_descriptions = {}
- @summary_only = true
end
def node_load_completed(node, expanded_run_list_with_versions, config)
@@ -111,10 +109,10 @@ class Chef
begin
resource_history_url = "reports/nodes/#{node.name}/runs"
server_response = @rest_client.post_rest(resource_history_url, {:action => :begin})
- run_uri = URI.parse(server_response["uri"])
- @run_id = ::File.basename(run_uri.path)
- Chef::Log.info("Chef server generated run history id: #{@run_id}")
- @summary_only = server_response["summary_only"]
+ #run_uri = URI.parse(server_response["uri"])
+ #@run_id = ::File.basename(run_uri.path)
+ #Chef::Log.info("Chef server generated run history id: #{@run_id}")
+ @run_id = UUIDTools::UUID.random_create
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
if !e.response || e.response.code.to_s != "404"
if Chef::Config[:enable_reporting_url_fatals]
@@ -188,18 +186,10 @@ class Chef
Chef::Log.debug run_data.inspect
compressed_data = encode_gzip(run_data.to_json)
begin
- #if summary only is enabled send the uncompressed run_data excluding the run_data["resources"] and some additional metrics.
- if @summary_only
- run_data = report_summary(run_data, compressed_data)
- Chef::Log.info("run_data_summary: #{run_data}")
- @rest_client.post_rest(resource_history_url, run_data)
- else
- 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)
- @rest_client.raw_http_request(:POST, reporting_url, {'Content-Encoding' => 'gzip'}, compressed_data)
- end
+ 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)
+ @rest_client.raw_http_request(:POST, reporting_url, {'Content-Encoding' => 'gzip'}, compressed_data)
rescue Net::HTTPServerException => e
if e.response.code.to_s == "400"
Chef::FileCache.store("failed-reporting-data.json", Chef::JSONCompat.to_json_pretty(run_data), 0640)
@@ -212,7 +202,7 @@ class Chef
Chef::Log.debug("Server doesn't support resource history, skipping resource report.")
end
end
-
+
def prepare_run_data
run_data = {}
run_data["action"] = "end"
@@ -235,13 +225,6 @@ class Chef
run_data
end
- def report_summary(run_data, compressed_data)
- run_data["updated_res_count"] = updated_resources.count.to_s
- run_data["post_size"] = compressed_data.bytesize.to_s
- run_data["resources"] = []
- run_data
- end
-
def run_list_expand_failed(node, exception)
description = Formatters::ErrorMapper.run_list_expand_failed(node, exception)
@error_descriptions = description.for_json