diff options
author | John Keiser <john@johnkeiser.com> | 2015-12-14 16:55:26 -0800 |
---|---|---|
committer | John Keiser <john@johnkeiser.com> | 2015-12-14 17:05:35 -0800 |
commit | fbf1f7d21c059d75b9978b34f9b9b5021c6dbfa3 (patch) | |
tree | d9f1f954ef252186680f5dcc9bb698426ca981d8 /lib/chef/resource_builder.rb | |
parent | 491e99e796673b5a3762d5a47ed51fabf1b6f8f1 (diff) | |
download | chef-fbf1f7d21c059d75b9978b34f9b9b5021c6dbfa3.tar.gz |
Only warn about potentially duplicate properties during the resource initializerjk/reduce-property-dup-warning
Diffstat (limited to 'lib/chef/resource_builder.rb')
-rw-r--r-- | lib/chef/resource_builder.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/chef/resource_builder.rb b/lib/chef/resource_builder.rb index 72b3788cf0..5b2ed4bb3f 100644 --- a/lib/chef/resource_builder.rb +++ b/lib/chef/resource_builder.rb @@ -70,7 +70,14 @@ class Chef resource.params = params # Evaluate resource attribute DSL - resource.instance_eval(&block) if block_given? + if block_given? + resource.resource_initializing = true + begin + resource.instance_eval(&block) + ensure + resource.resource_initializing = false + end + end # emit a cloned resource warning if it is warranted if prior_resource @@ -130,7 +137,7 @@ class Chef @prior_resource ||= begin key = "#{type}[#{name}]" - prior_resource = run_context.resource_collection.lookup(key) + run_context.resource_collection.lookup(key) rescue Chef::Exceptions::ResourceNotFound nil end |