summaryrefslogtreecommitdiff
path: root/lib/chef/data_collector
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2019-01-15 13:07:58 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2019-01-15 13:07:58 -0800
commit990974ca5cd44df0c77bb6a12fc57a3c32b92e23 (patch)
tree5779719f58254764e57eb9cacde85837295fd2f6 /lib/chef/data_collector
parent4be1ebe66460efb0535e500d6ecb52a147346519 (diff)
downloadchef-990974ca5cd44df0c77bb6a12fc57a3c32b92e23.tar.gz
changes for rubocop engine upgrades.lcg/rubocop-upgrades
this is the result of changes to rules we already previously had enabled. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/data_collector')
-rw-r--r--lib/chef/data_collector/messages.rb64
-rw-r--r--lib/chef/data_collector/resource_report.rb18
2 files changed, 41 insertions, 41 deletions
diff --git a/lib/chef/data_collector/messages.rb b/lib/chef/data_collector/messages.rb
index b4e30e8b5a..c375475c72 100644
--- a/lib/chef/data_collector/messages.rb
+++ b/lib/chef/data_collector/messages.rb
@@ -36,16 +36,16 @@ class Chef
#
def self.run_start_message(run_status)
{
- "chef_server_fqdn" => chef_server_fqdn,
- "entity_uuid" => node_uuid,
- "id" => run_status.run_id,
- "message_version" => "1.0.0",
- "message_type" => "run_start",
- "node_name" => run_status.node.name,
+ "chef_server_fqdn" => chef_server_fqdn,
+ "entity_uuid" => node_uuid,
+ "id" => run_status.run_id,
+ "message_version" => "1.0.0",
+ "message_type" => "run_start",
+ "node_name" => run_status.node.name,
"organization_name" => organization,
- "run_id" => run_status.run_id,
- "source" => collector_source,
- "start_time" => run_status.start_time.utc.iso8601,
+ "run_id" => run_status.run_id,
+ "source" => collector_source,
+ "start_time" => run_status.start_time.utc.iso8601,
}
end
@@ -61,34 +61,34 @@ class Chef
run_status = reporter_data[:run_status]
message = {
- "chef_server_fqdn" => chef_server_fqdn,
- "entity_uuid" => node_uuid,
- "expanded_run_list" => reporter_data[:expanded_run_list],
- "id" => run_status.run_id,
- "message_version" => "1.1.0",
- "message_type" => "run_converge",
- "node" => run_status.node,
- "node_name" => run_status.node.name,
- "organization_name" => organization,
- "resources" => reporter_data[:resources].map(&:report_data),
- "run_id" => run_status.run_id,
- "run_list" => run_status.node.run_list.for_json,
- "policy_name" => run_status.node.policy_name,
- "policy_group" => run_status.node.policy_group,
- "start_time" => run_status.start_time.utc.iso8601,
- "end_time" => run_status.end_time.utc.iso8601,
- "source" => collector_source,
- "status" => reporter_data[:status],
- "total_resource_count" => reporter_data[:resources].count,
+ "chef_server_fqdn" => chef_server_fqdn,
+ "entity_uuid" => node_uuid,
+ "expanded_run_list" => reporter_data[:expanded_run_list],
+ "id" => run_status.run_id,
+ "message_version" => "1.1.0",
+ "message_type" => "run_converge",
+ "node" => run_status.node,
+ "node_name" => run_status.node.name,
+ "organization_name" => organization,
+ "resources" => reporter_data[:resources].map(&:report_data),
+ "run_id" => run_status.run_id,
+ "run_list" => run_status.node.run_list.for_json,
+ "policy_name" => run_status.node.policy_name,
+ "policy_group" => run_status.node.policy_group,
+ "start_time" => run_status.start_time.utc.iso8601,
+ "end_time" => run_status.end_time.utc.iso8601,
+ "source" => collector_source,
+ "status" => reporter_data[:status],
+ "total_resource_count" => reporter_data[:resources].count,
"updated_resource_count" => reporter_data[:resources].select { |r| r.report_data["status"] == "updated" }.count,
- "deprecations" => reporter_data[:deprecations],
+ "deprecations" => reporter_data[:deprecations],
}
if run_status.exception
message["error"] = {
- "class" => run_status.exception.class,
- "message" => run_status.exception.message,
- "backtrace" => run_status.exception.backtrace,
+ "class" => run_status.exception.class,
+ "message" => run_status.exception.message,
+ "backtrace" => run_status.exception.backtrace,
"description" => reporter_data[:error_descriptions],
}
end
diff --git a/lib/chef/data_collector/resource_report.rb b/lib/chef/data_collector/resource_report.rb
index 6d63595cc2..9a99747f7f 100644
--- a/lib/chef/data_collector/resource_report.rb
+++ b/lib/chef/data_collector/resource_report.rb
@@ -67,16 +67,16 @@ class Chef
def to_h
hash = {
- "type" => new_resource.resource_name.to_sym,
- "name" => new_resource.name.to_s,
- "id" => resource_identity,
- "after" => new_resource_state_reporter,
- "before" => current_resource_state_reporter,
- "duration" => elapsed_time_in_milliseconds.to_s,
- "delta" => new_resource.respond_to?(:diff) && potentially_changed? ? new_resource.diff : "",
+ "type" => new_resource.resource_name.to_sym,
+ "name" => new_resource.name.to_s,
+ "id" => resource_identity,
+ "after" => new_resource_state_reporter,
+ "before" => current_resource_state_reporter,
+ "duration" => elapsed_time_in_milliseconds.to_s,
+ "delta" => new_resource.respond_to?(:diff) && potentially_changed? ? new_resource.diff : "",
"ignore_failure" => new_resource.ignore_failure,
- "result" => action.to_s,
- "status" => status,
+ "result" => action.to_s,
+ "status" => status,
}
if new_resource.cookbook_name