On Friday, September 14, 2012 3:36:20 PM UTC-7, Stefan Schulte wrote:
>
>
> I use this a lot to be able to have an optional parameter in a parent
> class that is passed to an included class and the included class
> determines the default value. Like:
>
> class basic($puppet_cron = undef) {
> class { 'puppet::client':
> cron => $puppet_cron,
> }
> }
>
>
Stefan - This is exactly the case I'm concerned about.
The simplest way to preserve this pattern would be putting the default
value for cron in the `basic` typedef, where you now have `undef`.
class basic($puppet_cron = "some_default") {
class { 'puppet::client':
cron => $puppet_cron,
}
}
The advantage is that if you want to really revert to the default for the
`cron` parameter, you can actually invoke it with undef, just like a
regular resource.
The bad side is that you now have to move your defaults to the calling
class, or worse, duplicate them.
What do you think?
-=Eric
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/puppet-users/-/ArCBBT7fg0EJ.
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-users?hl=en.