summaryrefslogtreecommitdiff
path: root/lib/chef/resource.rb
diff options
context:
space:
mode:
authorNoah Kantrowitz <noah@coderanger.net>2016-07-28 17:14:20 -0700
committerNoah Kantrowitz <noah@coderanger.net>2016-07-28 17:14:20 -0700
commit56af1a3713cd4f408c2c1d8658961c7b5df73192 (patch)
tree6248ef8714479e577dd3fefe17f76dde154905f1 /lib/chef/resource.rb
parent259be7a0cb3f7d7f7ee4d0f49211ddc8d9dcc1b9 (diff)
downloadchef-56af1a3713cd4f408c2c1d8658961c7b5df73192.tar.gz
So this was less vestigial than we thought. Those Chef::Resource
instances are created when subscribing against a string key. Leaving the conditionals removed, but adding a new stubby class to streamline things and a note on the RunContext side so we might remember how this works next time.
Diffstat (limited to 'lib/chef/resource.rb')
-rw-r--r--lib/chef/resource.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb
index 262aa84781..479eb0a7e2 100644
--- a/lib/chef/resource.rb
+++ b/lib/chef/resource.rb
@@ -260,6 +260,18 @@ class Chef
end
#
+ # Token class to hold an unresolved subscribes call with an associated
+ # run context.
+ #
+ # @api private
+ # @see Resource#subscribes
+ class UnresolvedSubscribes < self
+ # The full key ise given as the name in {Resource#subscribes}
+ alias_method :to_s, :name
+ alias_method :declared_key, :name
+ end
+
+ #
# Subscribes to updates from other resources, causing a particular action to
# run on *this* resource when the other resource is updated.
#
@@ -326,7 +338,7 @@ class Chef
resources = [resources].flatten
resources.each do |resource|
if resource.is_a?(String)
- resource = Chef::Resource.new(resource, run_context)
+ resource = UnresolvedSubscribes.new(resource, run_context)
end
if resource.run_context.nil?
resource.run_context = run_context