Felix

Thanks for the pointers there... 

As discussed on #puppet-dev, I've managed to get it working with the 
following code: https://gist.github.com/fatmcgav/8864343

However it does raise the question of "Is this the most optimal method to 
handle this scenario?" 

As it means iterating the entire catalog for each resource that wants to 
auto-require another resource. In a practical application, I could see 6+ 
resources of different types that might want to autorequire the domain 
resource.
Is there a more efficient method to pull out specific resource types from 
the catalogue? Or is the overhead from this operation likely to be soo 
small as not to worry? 

Cross posting to Puppet-dev mailing list for comment aswell. 

Cheers
Gavin 

On Friday, 7 February 2014 12:50:58 UTC, Felix.Frank wrote:
>
> Hi, 
>
> I suppose that should be possible, although the autorequire block will 
> be a lot more complex than those you're using right now (obviously, 
> since those are almost trivial - in a good way :-) 
>
> You can filter the list of all resources in the catalog for interesting 
> things to autorequire. This general pattern might get you going 
> (untested though) 
>
> autorequire(...) do 
>   self.catalog.resources.select { |res| 
>     # pseudo-code: resource is of desired type 
>     # and has desired properties/parameters 
>   }.collect { |res| 
>     res[:name] 
>   } 
> end 
>
> Not even sure if :name is the correct key, but I hope this brings the 
> idea across. 
>
> HTH, 
> Felix 
>
> On 02/07/2014 12:51 PM, Gavin Williams wrote: 
> > In other-words, if I want the /application/ resource type to 
> > auto-require the appropriate /domain/ resource type, the only 
> > information I have to relate is based on the '/portbase/' param[3][4]. 
> > 
> > Is this technically possible? Or am I barking up the wrong tree??? 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/1bd120b9-3ff8-410d-8309-8261b225665d%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to