Re: [Puppet-dev] Accessing puppet catalog in provider self.* methods

2015-01-30 Thread Eli Young
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 > wrote: > >> On Friday, January 30, 2015 at 12:24:25 PM UTC-8, Nan Liu wrote: >>> >>> I was able to work around

Re: [Puppet-dev] Accessing puppet catalog in provider self.* methods

2015-01-30 Thread Nan Liu
On Fri, Jan 30, 2015 at 2:34 PM, Eli Young 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 = r

Re: [Puppet-dev] Accessing puppet catalog in provider self.* methods

2015-01-30 Thread Eli Young
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: catalo

Re: [Puppet-dev] Accessing puppet catalog in provider self.* methods

2015-01-30 Thread Trevor Vaughan
That makes sense, and yeah, that whole catalog should be there unless you're dynamically injecting resources. You might want to add a check before splunk_config['forwarder_confdir'] in case you didn't find the resource in the catalog so you don't hit a null pointer issue. Not seeing a better way

Re: [Puppet-dev] Accessing puppet catalog in provider self.* methods

2015-01-30 Thread Nan Liu
On Fri, Jan 30, 2015 at 1:12 PM, Trevor Vaughan wrote: > If you do access the catalog in a self.* method, it's completely compile > order dependent and you'll only have access to the catalog as compiled to > that point, not the entire catalog. > It should be the whole catalog since the provider

Re: [Puppet-dev] Accessing puppet catalog in provider self.* methods

2015-01-30 Thread Trevor Vaughan
If you do access the catalog in a self.* method, it's completely compile order dependent and you'll only have access to the catalog as compiled to that point, not the entire catalog. You have access to the entire catalog in the 'finish' method of the type, but that may be too late. Trevor On Fri

Re: [Puppet-dev] Accessing puppet catalog in provider self.* methods

2015-01-30 Thread Nan Liu
On Fri, Jan 30, 2015 at 7:29 AM, Luke Kanies wrote: > On Jan 30, 2015, at 1:37 AM, Nan Liu wrote: > > > I'm trying to use ini_setting as a parent provider. Everything works well, > but to support purging, the resources provider need to specify the target > file via self.file_path. Initially this

Re: [Puppet-dev] Accessing puppet catalog in provider self.* methods

2015-01-30 Thread Luke Kanies
On Jan 30, 2015, at 1:37 AM, Nan Liu wrote: > > I'm trying to use ini_setting as a parent provider. Everything works well, > but to support purging, the resources provider need to specify the target > file via self.file_path. Initially this seems straightforward, but the config > file location

Re: [Puppet-dev] Accessing puppet catalog in provider self.* methods

2015-01-29 Thread Trevor Vaughan
Hi Nan, Not sure if this will do what you want, but can you use 'initialize' to set up an instance variable that pulls from the catalog and then reference that instance variable later in your self.* methods? Thanks, Trevor On Thu, Jan 29, 2015 at 8:37 PM, Nan Liu wrote: > I'm trying to use in

[Puppet-dev] Accessing puppet catalog in provider self.* methods

2015-01-29 Thread Nan Liu
I'm trying to use ini_setting as a parent provider. Everything works well, but to support purging, the resources provider need to specify the target file via self.file_path. Initially this seems straightforward, but the config file location can vary based on installation settings. All the examples