diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-07-01 12:24:10 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-07-01 12:24:10 -0700 |
commit | 1ab6e838b7dafc06fd5ec8e1ff7add9a7be5e2cb (patch) | |
tree | ae8e7810403abb28cef424f3a3bdbf75291c4ab4 | |
parent | 0bdd358decddf4251c20ced1eb48e54057eb2418 (diff) | |
download | chef-1ab6e838b7dafc06fd5ec8e1ff7add9a7be5e2cb.tar.gz |
revert the code cleanup
unfortunately we can't have nice things
-rw-r--r-- | lib/chef/resource_builder.rb | 15 | ||||
-rw-r--r-- | spec/support/lib/chef/resource/zen_master.rb | 14 |
2 files changed, 20 insertions, 9 deletions
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 diff --git a/spec/support/lib/chef/resource/zen_master.rb b/spec/support/lib/chef/resource/zen_master.rb index 4b94e7415c..f5137c18ec 100644 --- a/spec/support/lib/chef/resource/zen_master.rb +++ b/spec/support/lib/chef/resource/zen_master.rb @@ -24,8 +24,18 @@ class Chef class ZenMaster < Chef::Resource allowed_actions :win, :score - property :peace - property :something + attr_reader :peace + + def peace(tf) + @peace = tf + end + + def something(arg = nil) + if !arg.nil? + @something = arg + end + @something + end end end end |