summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
authorDJ Mountney <david@twkie.net>2017-08-10 14:11:48 -0700
committerDJ Mountney <david@twkie.net>2017-08-10 14:11:48 -0700
commitbc5acbe0d0f1d7e1de409694ff56cd721598c31f (patch)
treedd05e416d1fa4acaf320053e08bd04dbc7d03d18 /lib/chef
parent7372d0ece166ee0d5a3e25bf84861807995e58be (diff)
downloadchef-bc5acbe0d0f1d7e1de409694ff56cd721598c31f.tar.gz
Fix an issue where DeepMerge overwrites nil values
When run against a VividMash. Call .key? instead of [] when checking if a key exists for a VividMash Otherwise the VividMash will return an empty object instead of nil for that key. Signed-off-by: DJ Mountney <david@twkie.net>
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/mixin/deep_merge.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/chef/mixin/deep_merge.rb b/lib/chef/mixin/deep_merge.rb
index 7016b08ff7..9ec2b397d4 100644
--- a/lib/chef/mixin/deep_merge.rb
+++ b/lib/chef/mixin/deep_merge.rb
@@ -64,7 +64,7 @@ class Chef
when Hash
if dest.kind_of?(Hash)
source.each do |src_key, src_value|
- if dest[src_key]
+ if dest.key?(src_key)
dest[src_key] = deep_merge!(src_value, dest[src_key])
else # dest[src_key] doesn't exist so we take whatever source has
dest[src_key] = src_value