On Fri, Jan 30, 2015 at 1:12 PM, Trevor Vaughan <tvaug...@onyxpoint.com>
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 is running once
everything is compiled. The partial catalog problem is only with puppet
functions (or anything in a manifest).

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

The whole work around have been submitted as a PR [1]. I am open for a
better solution, since this doesn't seem ideal.

Nan

1. https://github.com/puppetlabs/puppetlabs-splunk/pull/14

-- 
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 puppet-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/CACqVBqD0d5Tf-URcPT%3D0yhOex6795zeD3n9n_mvpXHS1i6mh8Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to