diff options
author | NAshwini <ashwini.nehate@msystechnologies.com> | 2019-12-18 17:27:37 +0530 |
---|---|---|
committer | NAshwini <ashwini.nehate@msystechnologies.com> | 2020-02-12 17:03:22 +0530 |
commit | 2a765665ec66b76b98ba80bd6bb6297094ffd7b2 (patch) | |
tree | 30beeaac321706523a253ddc20199616226c9cb4 /lib/chef/knife | |
parent | e613e3d7d4f773b66aceee9cd4fba8a0df9d5769 (diff) | |
download | chef-2a765665ec66b76b98ba80bd6bb6297094ffd7b2.tar.gz |
Optimize by using Mash as per review comments
Signed-off-by: NAshwini <ashwini.nehate@msystechnologies.com>
Diffstat (limited to 'lib/chef/knife')
-rw-r--r-- | lib/chef/knife/core/bootstrap_context.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/chef/knife/core/bootstrap_context.rb b/lib/chef/knife/core/bootstrap_context.rb index 9eb9e0143e..b9d036f21f 100644 --- a/lib/chef/knife/core/bootstrap_context.rb +++ b/lib/chef/knife/core/bootstrap_context.rb @@ -205,15 +205,14 @@ class Chef end def first_boot - (@config[:first_boot_attributes] || {}).tap do |attributes| + (@config[:first_boot_attributes] = Mash.new(@config[:first_boot_attributes]) || Mash.new).tap do |attributes| if @config[:policy_name] && @config[:policy_group] attributes[:policy_name] = @config[:policy_name] attributes[:policy_group] = @config[:policy_group] else attributes[:run_list] = @run_list end - - attributes.delete(:run_list) if ( attributes[:policy_name] && !attributes[:policy_name].empty? ) || ( attributes["policy_name"] && !attributes["policy_name"].empty? ) + attributes.delete(:run_list) if attributes[:policy_name] && !attributes[:policy_name].empty? attributes.merge!(tags: @config[:tags]) if @config[:tags] && !@config[:tags].empty? end end |