From bd85e888c4c9b4d38b3a88f89b5995619e654ed0 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Thu, 20 Nov 2014 17:07:05 -0800 Subject: 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. --- lib/chef/mixin/deep_merge.rb | 33 --------------------------------- 1 file changed, 33 deletions(-) (limited to 'lib/chef/mixin/deep_merge.rb') 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 -- cgit v1.2.1