From 1ab6e838b7dafc06fd5ec8e1ff7add9a7be5e2cb Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Fri, 1 Jul 2016 12:24:10 -0700 Subject: revert the code cleanup unfortunately we can't have nice things --- lib/chef/resource_builder.rb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'lib/chef/resource_builder.rb') diff --git a/lib/chef/resource_builder.rb b/lib/chef/resource_builder.rb index ee44b6714c..1641fe60f2 100644 --- a/lib/chef/resource_builder.rb +++ b/lib/chef/resource_builder.rb @@ -113,17 +113,18 @@ class Chef # this is an equality test specific to checking for 3694 cloning warnings def identicalish_resources?(first, second) - non_matching_properties = first.class.properties.reject do |sym, property| - if !property.is_set?(first) && !property.is_set?(second) + skipped_ivars = [ :@source_line, :@cookbook_name, :@recipe_name, :@params, :@elapsed_time, :@declared_type ] + checked_ivars = ( first.instance_variables | second.instance_variables ) - skipped_ivars + non_matching_ivars = checked_ivars.reject do |iv| + if iv == :@action && ( [first.instance_variable_get(iv)].flatten == [:nothing] || [second.instance_variable_get(iv)].flatten == [:nothing] ) + # :nothing action on either side of the comparison always matches true - elsif property.is_set?(first) && property.is_set?(second) - property.send(:get_value, first) == property.send(:get_value, second) else - false + first.instance_variable_get(iv) == second.instance_variable_get(iv) end end - Chef::Log.debug("ivars which did not match with the prior resource: #{non_matching_properties.keys}") - non_matching_properties.empty? + Chef::Log.debug("ivars which did not match with the prior resource: #{non_matching_ivars}") + non_matching_ivars.empty? end def emit_cloned_resource_warning -- cgit v1.2.1