On Jul 26, 2012, at 1:41 AM, Anastasis Andronidis <[email protected]> wrote:

> Hello, I am a new developer on puppet plugins. I am currently trying to add a 
> new feature to this plugin 
> (https://github.com/puppetlabs/puppetlabs-firewall).
> 
> My problem is that I need to access the catalog from the self.instances 
> function. The concept is that this plugin is making instances of firewall 
> rules through this function. I want to skip some rules so puppet can not 
> manage them. To do this I need to access the catalog from within this 
> function. 
> 
> Is there a way to do so? The only thing I was able to do until now, was to 
> access the catalog from any instance method of a provider though 
> resource.catalog. But this is not working on class method self.instances


In general, the 'instances' method should return all resources, not just 
unmanaged resources.  It's the job of a given provider's 'prefetch' function to 
match managed resources (that is, those in the catalog) with those on the 
system.

For instance, say you have 5 rules on disk (1-5) and 3 rules in memory (4-6).  
Firewall.instances would return instances 1-5; the firewall provider would 
match the instances to rules 4 and 5, but would correctly find that 1-3 aren't 
managed, and rule 6 is not represented on disk.

I think there are default 'prefetch' methods that do this, but I can't actually 
remember.  There are plenty of examples to look at, though.

Does that solve the problem?

-- 
Luke Kanies | http://about.me/lak | http://puppetlabs.com/ | +1-615-594-8199

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to