On 01/25/2012 05:48 AM, Walter Heck wrote: >>> We'd also need a way to test if a capability is being provided by the >>> >> system as a whole. Ie, a mysql module needs to be able to check if it >>> >> needs to include resources for a firewall, monitoring, etc. >> > Something like defined()? ;-) > Come on, I thought we all agreed that defined is Nasty and Evil. At > least make it defined_new() or maybe even defined2() :P
Great, now we're regressing back to thread that Nigel kicked me out of for this :P Fine, I'll play. On 01/19/2012 07:56 PM, Nick Fagerlund wrote: > Defined() doesn't suck! It's a 100% reliable way to check what classes > and defined types are available to the autoloader. I challenge anyone > to find me an example of this usage that fails. > > But trying to use it to see whether a specific resource instance has > been declared is pure madness and must be stopped. It's defined(), not > declared(), and it shouldn't accept resource references as arguments > at all. So there. In that thread, Nick gave pretty much the very use case example Nan has referred to earlier in this thread, so I hope we can agree that this can be handled by the (newly introduced?) declared() function (or stripped down version of defined() that won't allow resource reference parameters). On 01/19/2012 09:17 PM, Nick Fagerlund wrote: > So, you can conditionally declare the rule if the defined type is > available to the autoloader, and otherwise you don't attempt to manage > the firewall and expect that the user has read the documentation and > will make a hole for the service themselves. > > if defined(firewall::iptables::rule) { > firewall::iptables::rule {'mysql_server': > ...etc. etc. > } > } > > See? It's just a way to peek around at what the user has installed. Cheers, Felix -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.