On 2014-07-04 18:31, Erik Dalén wrote:
Due to the dynamic scoping of them I only really use them for setting global defaults. And some mechanism for doing that is really needed.
I've used to do that to set file buckets and Exec#path. But importing modules really put a stop to that as I saw that I didn't really need that:
https://github.com/DavidS/dasz-configuration/blob/master/manifests/site.pp
Using them inside classes is really mostly syntactic sugar to get the code shorter. But I've also seen them used to conditionally set an attribute. So not set it to value or undef, to set it to value or not set it at all, as that has slightly different semantics. But that would also really be better to do with some sort of postfix if condition in the resource declaration.
Like this: file { "/foo": ;} if $x { File["/foo"] { source => $x } } ? See
https://github.com/DavidS/dasz-configuration/blob/master/modules/hosting/manifests/customer_service.pp#L17
for a more elaborate example. Regards, David -- 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/53B70B37.20309%40dasz.at. For more options, visit https://groups.google.com/d/optout.