summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2013-01-16 17:01:44 -0800
committerdanielsdeleo <dan@opscode.com>2013-01-17 11:28:41 -0800
commit04a8406213741d2e4606a188f36d85e4ad1b7ae6 (patch)
treea5613caea9935931e1c7c1a4b427c4ca50172c99
parent186eb9cacc54f73292b6c256cfae4866744a6c21 (diff)
downloadchef-04a8406213741d2e4606a188f36d85e4ad1b7ae6.tar.gz
[CHEF-3771] fix spurious warnings about resource cloning
-rw-r--r--chef/lib/chef/resource.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/chef/lib/chef/resource.rb b/chef/lib/chef/resource.rb
index b5ed8b74bb..18dc3d222c 100644
--- a/chef/lib/chef/resource.rb
+++ b/chef/lib/chef/resource.rb
@@ -262,9 +262,11 @@ F
def load_prior_resource
begin
+ prior_resource = run_context.resource_collection.lookup(self.to_s)
+ # if we get here, there is a prior resource (otherwise we'd have jumped
+ # to the rescue clause).
Chef::Log.warn("Cloning resource attributes for #{self.to_s} from prior resource (CHEF-3694)")
Chef::Log.warn("From: #{self.source_line}") if self.source_line
- prior_resource = run_context.resource_collection.lookup(self.to_s)
prior_resource.instance_variables.each do |iv|
unless iv.to_sym == :@source_line || iv.to_sym == :@action || iv.to_sym == :@not_if || iv.to_sym == :@only_if
self.instance_variable_set(iv, prior_resource.instance_variable_get(iv))