summaryrefslogtreecommitdiff
path: root/lib/chef/resource.rb
diff options
context:
space:
mode:
authorJohn Keiser <john@johnkeiser.com>2015-12-14 16:55:26 -0800
committerJohn Keiser <john@johnkeiser.com>2015-12-14 17:05:35 -0800
commitfbf1f7d21c059d75b9978b34f9b9b5021c6dbfa3 (patch)
treed9f1f954ef252186680f5dcc9bb698426ca981d8 /lib/chef/resource.rb
parent491e99e796673b5a3762d5a47ed51fabf1b6f8f1 (diff)
downloadchef-fbf1f7d21c059d75b9978b34f9b9b5021c6dbfa3.tar.gz
Only warn about potentially duplicate properties during the resource initializerjk/reduce-property-dup-warning
Diffstat (limited to 'lib/chef/resource.rb')
-rw-r--r--lib/chef/resource.rb15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb
index a7b1f63463..4aec8cf1f6 100644
--- a/lib/chef/resource.rb
+++ b/lib/chef/resource.rb
@@ -569,8 +569,6 @@ class Chef
#
def run_action(action, notification_type=nil, notifying_resource=nil)
# reset state in case of multiple actions on the same resource.
- old_currently_running_action = @currently_running_action
- @currently_running_action = action
@elapsed_time = 0
start_time = Time.now
events.resource_action_start(self, action, notification_type, notifying_resource)
@@ -612,7 +610,6 @@ class Chef
end
end
ensure
- @currently_running_action = old_currently_running_action
@elapsed_time = Time.now - start_time
# Reporting endpoint doesn't accept a negative resource duration so set it to 0.
# A negative value can occur when a resource changes the system time backwards
@@ -621,12 +618,18 @@ class Chef
end
#
- # If we are currently running an action, this shows the action we are running.
- # If the resource is running multiple actions at once, this will show the most recent.
+ # If we are currently initializing the resource, this will be true.
#
# Do NOT use this. It may be removed. It is for internal purposes only.
# @api private
- attr_reader :currently_running_action
+ attr_reader :resource_initializing
+ def resource_initializing=(value)
+ if value
+ @resource_initializing = true
+ else
+ remove_instance_variable(:@resource_initializing)
+ end
+ end
#
# Generic Ruby and Data Structure Stuff (for user)