-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Labels
Description
Example for how this is currently used/implemented:
def get_config(instance = resource[:instance])
config_resc = resource.catalog.resources.find do |resc|
resc.title =~ %r{Sqlserver::Config} &&
resc.original_parameters[:instance_name] =~ %r{#{instance}}i
end
if config_resc.nil?
raise("Sqlserver_tsql[#{resource.title}] was unable to retrieve the config, please ensure the catalog contains sqlserver::config{'#{resource[:instance]}':}")
end
config_resc.original_parameters
endPuppet::Type's resource.catalog.resources provides access to other resources in the current catalog.
Possible implementation:
- Add a
raw_catalog_accessfeature flag tosupported_features = %w[supports_noop canonicalize remote_resource simple_get_filter].freeze - add
catalogaccessor todef initialize(definition) - pass reference to
resource.catalogto context every time one is created iff theraw_catalog_accessfeature is declared on the type definition- - might need additional changes if
puppet-resource_api/lib/puppet/resource_api.rb
Lines 428 to 434 in bd93dba
define_singleton_method(:context) do @context ||= PuppetContext.new(TypeDefinition.new(definition)) end def context self.class.context end resource.catalogis not available at the class level - add pass through here:
def initialize(definition, target = $stderr, transport = nil)
- adjust testing for these changes
- update docs