diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2020-09-03 12:43:58 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2020-09-03 12:47:16 -0700 |
commit | f8189e22d767ff2e5ccf5f906f5f88652627bb34 (patch) | |
tree | 2ffa1c30e3a488d50cc4c41b3b5237801fadc848 /lib | |
parent | fb4197f19f60740780c35f4ff37adbd493fdb2dc (diff) | |
download | chef-f8189e22d767ff2e5ccf5f906f5f88652627bb34.tar.gz |
Fix nil deep_merginglcg/fix-nil-deep-merge
While this behavior was fixed for attributes a long, long time ago it
turns out we don't use this deep_merge mixin for constructing the
deep merge of attribute precedence levels any more.
This bug however surfaces because we still use deep_merge to merge
json attributes into normal attributes. That means that it is not
possible to pass a nil / null value in through -j and have it override
a normal attribute which is pulled back in from the node object on
the chef-server.
So this fixes that behavior to be consistent with the behavior of
attributes that we've had for several years now.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/mixin/deep_merge.rb | 12 |
1 files changed, 0 insertions, 12 deletions
diff --git a/lib/chef/mixin/deep_merge.rb b/lib/chef/mixin/deep_merge.rb index 300ae1a31f..ad9c9e89dd 100644 --- a/lib/chef/mixin/deep_merge.rb +++ b/lib/chef/mixin/deep_merge.rb @@ -75,14 +75,7 @@ class Chef # @api private # def deep_merge!(source, dest) - # if dest doesn't exist, then simply copy source to it - if dest.nil? - dest = source; return dest - end - case source - when nil - dest when Hash if dest.is_a?(Hash) source.each do |src_key, src_value| @@ -147,11 +140,6 @@ class Chef end end merge_onto - - # If merge_with is nil, don't replace merge_onto - elsif merge_with.nil? - merge_onto - # In all other cases, replace merge_onto with merge_with else merge_with |