----- Original Message ----- > > > On Jan 19, 11:01 am, "R.I.Pienaar" <r...@devco.net> wrote: > > ----- Original Message ----- > > > 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. > > > > can you give an example of this use case pls? > > Well... that's something I realized after I posted that, is I'm not > sure if anyone WANTS a reliable way to test the autoloader. > (Obviously > people do want a way to check for resource instances, which is why > defined() keeps getting used for that...) > > But anyway! Say you make a module for a network service and you want > it to be able to manage its own firewall rule. You know of a defined > type for firewall rules, and you're using it, but you want your > module > to be portable and you know of good reasons why someone wouldn't be > using your iptables module. > > 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.
right, I must have missed this behavior previously, yeah this has value and should be retained, checking for declared resources should go then -- 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.