summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2014-12-16 14:54:51 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2014-12-16 14:54:51 -0800
commit562bfe4900a1e6c36e0abb0977bc0d74e4d66508 (patch)
tree177bb660dfe329a08454ae94e6651808a5f253cc
parent086bf6068f13322165f894925f3b2b3b0badc596 (diff)
downloadchef-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.rb13
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)