INNER CODE UNIT · Ruby
self
stevius10/Proxmox-GitOps · config/libraries/default.rb:60
def self.rc(obj)
return obj.run_context if obj.respond_to?(:run_context)
return obj if defined?(Chef::RunContext) && obj.is_a?(Chef::RunContext)
nil
end
def self.find(obj, type, name, &block)
rctx = rc(obj)
if rctx && rctx.respond_to?(:resource_collection)
begin
return rctx.resource_collection.find("#{type}[#{name}]")
rescue Chef::Exceptions::ResourceNotFound
end
end
dsl(obj).public_send(type, name, &block)
end
end