diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2014-12-16 14:54:51 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2014-12-16 14:54:51 -0800 |
commit | 562bfe4900a1e6c36e0abb0977bc0d74e4d66508 (patch) | |
tree | 177bb660dfe329a08454ae94e6651808a5f253cc | |
parent | 086bf6068f13322165f894925f3b2b3b0badc596 (diff) | |
download | chef-562bfe4900a1e6c36e0abb0977bc0d74e4d66508.tar.gz |
add :@params, :@elapsed_time and :@action
:@action is only ignored when one or the other of the actions is
set to :nothing.
-rw-r--r-- | lib/chef/resource.rb | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb index 61a3cbd155..b78d4663c3 100644 --- a/lib/chef/resource.rb +++ b/lib/chef/resource.rb @@ -297,11 +297,18 @@ F end def identical_resource?(prior_resource) - skipped_ivars = [ :@source_line, :@cookbook_name, :@recipe_name ] + skipped_ivars = [ :@source_line, :@cookbook_name, :@recipe_name, :@params, :@elapsed_time ] checked_ivars = prior_resource.instance_variables - skipped_ivars - checked_ivars.all? do |iv| - self.instance_variable_get(iv) == prior_resource.instance_variable_get(iv) + non_matching_ivars = checked_ivars.reject do |iv| + if iv == :@action && ( [self.instance_variable_get(iv)].flatten == [:nothing] || [prior_resource.instance_variable_get(iv)].flatten == [:nothing] ) + # :nothing action on either side of the comparison always matches + true + else + self.instance_variable_get(iv) == prior_resource.instance_variable_get(iv) + end end + Chef::Log.debug("ivars which did not match with the prior resource: #{non_matching_ivars}") + non_matching_ivars.empty? end def load_prior_resource(resource_type, instance_name) |