summaryrefslogtreecommitdiff
path: root/lib/chef/mixin/deep_merge.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2014-11-20 17:07:05 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2014-11-21 15:04:23 -0800
commitbd85e888c4c9b4d38b3a88f89b5995619e654ed0 (patch)
tree6ef84c5da4f9e5aa600ef92770ad634b15c6377c /lib/chef/mixin/deep_merge.rb
parentf7585fccb289549c0cc1b123030b994cd474b802 (diff)
downloadchef-bd85e888c4c9b4d38b3a88f89b5995619e654ed0.tar.gz
remove old knockout merge exception
chef 11 has raised an exception on this for nearly 2 years, we now simply no longer care and don't spend the cycles to check.
Diffstat (limited to 'lib/chef/mixin/deep_merge.rb')
-rw-r--r--lib/chef/mixin/deep_merge.rb33
1 files changed, 0 insertions, 33 deletions
diff --git a/lib/chef/mixin/deep_merge.rb b/lib/chef/mixin/deep_merge.rb
index a8a4737758..58b6f18b07 100644
--- a/lib/chef/mixin/deep_merge.rb
+++ b/lib/chef/mixin/deep_merge.rb
@@ -29,15 +29,6 @@ class Chef
class InvalidSubtractiveMerge < ArgumentError; end
-
- OLD_KNOCKOUT_PREFIX = "!merge:".freeze
-
- # Regex to match the "knockout prefix" that was used to indicate
- # subtractive merging in Chef 10.x and previous. Subtractive merging is
- # removed as of Chef 11, but we detect attempted use of it and raise an
- # error (see: raise_if_knockout_used!)
- OLD_KNOCKOUT_MATCH = %r[!merge].freeze
-
extend self
def merge(first, second)
@@ -78,8 +69,6 @@ class Chef
dest = source; return dest
end
- raise_if_knockout_used!(source)
- raise_if_knockout_used!(dest)
case source
when nil
dest
@@ -89,7 +78,6 @@ class Chef
if dest[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
- raise_if_knockout_used!(src_value)
dest[src_key] = src_value
end
end
@@ -146,27 +134,6 @@ class Chef
end
end
- # Checks for attempted use of subtractive merge, which was removed for
- # Chef 11.0. If subtractive merge use is detected, will raise an
- # InvalidSubtractiveMerge exception.
- def raise_if_knockout_used!(obj)
- if uses_knockout?(obj)
- raise InvalidSubtractiveMerge, "subtractive merge with !merge is no longer supported"
- end
- end
-
- # Checks for attempted use of subtractive merge in +obj+.
- def uses_knockout?(obj)
- case obj
- when String
- obj =~ OLD_KNOCKOUT_MATCH
- when Array
- obj.any? {|element| element.respond_to?(:gsub) && element =~ OLD_KNOCKOUT_MATCH }
- else
- false
- end
- end
-
def deep_merge(source, dest)
deep_merge!(safe_dup(source), safe_dup(dest))
end