From 53a48e49f0a8e474a287698dc93ce9727358b467 Mon Sep 17 00:00:00 2001 From: Vivek Singh Date: Wed, 18 Sep 2019 10:24:37 +0530 Subject: Access hash directly instead of Hash#fetch - Rename "expanded_cookbooks" to "cookbooks". Signed-off-by: Vivek Singh --- lib/chef/data_collector/run_end_message.rb | 2 +- spec/unit/data_collector_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/chef/data_collector/run_end_message.rb b/lib/chef/data_collector/run_end_message.rb index 5c23224678..762058bfdb 100644 --- a/lib/chef/data_collector/run_end_message.rb +++ b/lib/chef/data_collector/run_end_message.rb @@ -57,7 +57,7 @@ class Chef "resources" => all_action_records(action_collection), "run_id" => run_status&.run_id, "run_list" => node&.run_list&.for_json || [], - "expanded_cookbooks" => node&.fetch("cookbooks", {}) || {}, + "cookbooks" => ( node && node["cookbooks"] ) || {}, "policy_name" => node&.policy_name, "policy_group" => node&.policy_group, "start_time" => run_status.start_time.utc.iso8601, diff --git a/spec/unit/data_collector_spec.rb b/spec/unit/data_collector_spec.rb index 28d677aa6a..5eeeec1498 100644 --- a/spec/unit/data_collector_spec.rb +++ b/spec/unit/data_collector_spec.rb @@ -46,7 +46,7 @@ describe Chef::DataCollector do let(:run_list) { node.run_list } - let(:expanded_cookbooks) { node.fetch("cookbooks", {}) } + let(:cookbooks) { node.fetch("cookbooks", {}) } let(:run_id) { run_status.run_id } @@ -214,7 +214,7 @@ describe Chef::DataCollector do end it "has a cookbooks" do - expect_converge_message("expanded_cookbooks" => expanded_cookbooks) + expect_converge_message("cookbooks" => cookbooks) send_run_failed_or_completed_event end -- cgit v1.2.1