On Dec 3, 2014 6:53 AM, "Martijn Grendelman" <[email protected]>
wrote:
>
> Hi,
>
> Please consider the following simplified code:
>
> class apache::params {
> $priority = 25
> }
>
> define apache::vhost (
> $priority = $::apache::params::priority
> ) {
>
> include apache::params
>
> notify { "$name prio 1: $apache::params::priority": }
> notify { "$name prio 2: $priority": }
> }
>
> apache::vhost { 'test': }
>
>
> Is there ANY way that the notifys in the apache::vhost type would display
a different value? Shouldn't $apache::params::priority and $priority not be
the same?

AIUI, with a class, you'd need to inherit from params for the default to
work. With a define, I suspect it's parse-order dependent and you've just
gotten lucky.

Rather than doing what you're doing, consider making the default undef and
using 'pick' from puppetlabs/stdlib to choose:

  $real_priority = pick($priority, $apache::params::priority)

> I have a case where on some nodes, $priority (and other parameters that
have defaults from $::apache::params that I omitted here) are empty
(undef). If I access $::apache::params::priority directly, the correct
value is presented.
> This code is in use on many nodes, and most don't exhibit the problem.
>
> Any idea what might be the problem here? I've been trying different
things for over an hour, and I'm afraid I'm losing my sanity...
>
> Best regards,
> Martijn.
>
> --
> 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 [email protected].
> To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/4b344b14-de9b-446c-93e7-110d335f91cd%40googlegroups.com
.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAMmm3r7wyzZjs%3Dt21_JJ_VMBgD5X5548i-D-eADcveuah8gdCQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to