Oh, gotcha.  Sorry, forgot that you had to do this in the class context.

On Friday, January 30, 2015 at 2:20:28 PM UTC-8, Nan Liu wrote:
>
> On Fri, Jan 30, 2015 at 2:34 PM, Eli Young <[email protected] 
> <javascript:>> wrote:
>
>> On Friday, January 30, 2015 at 12:24:25 PM UTC-8, Nan Liu wrote:
>>>
>>> I was able to work around this by abusing self.prefetch, since the 
>>> transaction layer passes in a subset of resources:
>>>
>>> def self.prefetch(resources)
>>>     catalog = resources[resources.keys.first].catalog
>>>     # Note: catalog.resources != resources
>>>     splunk_config = catalog.resources.find{|s| s.type == :splunk_config}
>>>     confdir = splunk_config['forwarder_confdir'] || 
>>> raise(Puppet::Error, 'Unknown splunk forwarder confdir')
>>>     @file_path = File.join(confdir, 'outputs.conf')
>>> end
>>>
>>
>> Is abusing prefetch even necessary?  I'm fairly certain that you can 
>> access the catalog from the provider via resource.catalog.
>>
>
> resource does not appear to be available in self.* class methods, only 
> instance methods. 
>
> Thanks,
>
> Nan
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/8446d5c4-2adc-4e44-9087-1e92b5712e7d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to