module ChefCompat::Monkeypatches::Chef::ResourceCollection::RecursiveNotificationLookup

Attributes

run_context[RW]

Copied verbatim from Chef 12.10.24

Public Class Methods

new(run_context = nil) click to toggle source
Calls superclass method
# File files/lib/chef_compat/monkeypatches/chef/resource_collection.rb, line 35
def initialize(run_context = nil)
  super()
  @run_context = run_context
end

Public Instance Methods

find(*args) click to toggle source
# File files/lib/chef_compat/monkeypatches/chef/resource_collection.rb, line 56
def find(*args)
  if run_context.nil?
    find_local(*args)
  else
    find_recursive(run_context, *args)
  end
end
find_local(*args) click to toggle source
# File files/lib/chef_compat/monkeypatches/chef/resource_collection.rb, line 44
def find_local(*args)
  resource_set.find(*args)
end
lookup(key) click to toggle source
# File files/lib/chef_compat/monkeypatches/chef/resource_collection.rb, line 48
def lookup(key)
  if run_context.nil?
    lookup_local(key)
  else
    lookup_recursive(run_context, key)
  end
end
lookup_local(key) click to toggle source
# File files/lib/chef_compat/monkeypatches/chef/resource_collection.rb, line 40
def lookup_local(key)
  resource_set.lookup(key)
end

Private Instance Methods

find_recursive(rc, *args) click to toggle source
# File files/lib/chef_compat/monkeypatches/chef/resource_collection.rb, line 73
def find_recursive(rc, *args)
  rc.resource_collection.send(:resource_set).find(*args)
rescue ::Chef::Exceptions::ResourceNotFound
  raise if !rc.respond_to?(:parent_run_context) || rc.parent_run_context.nil?
  find_recursive(rc.parent_run_context, *args)
end
lookup_recursive(rc, key) click to toggle source
# File files/lib/chef_compat/monkeypatches/chef/resource_collection.rb, line 66
def lookup_recursive(rc, key)
  rc.resource_collection.send(:resource_set).lookup(key)
rescue ::Chef::Exceptions::ResourceNotFound
  raise if !rc.respond_to?(:parent_run_context) || rc.parent_run_context.nil?
  lookup_recursive(rc.parent_run_context, key)
end