Hi,
On 24 avr, 18:40, jcbollinger <[email protected]> wrote:
> Another alternative would be to do exactly as you would have done with
> 0.24 or 0.25. Global variables, node variables, and dynamic scoping
> still work in 2.6, and even 2.7 (though 2.7 will issue warnings about
> resolving variables via dynamic scoping). As far as I know, global
> variables will be supported in Telly, too, though you will have to
> reference them by their fully-qualified names.
>
I'm back at fiddling with globals or hiera. Not sure yet which way
we'll go but while playing around, I've have some unexpected results.
manifests/site.pp:
$globalenv = "prod"
node 'centos6.priv.net' {
$globalenv = "int"
class { "yum" :
}
}
modules/yum/manifests/init.pp
class yum::params {
notify { "yum-params" :
message => "yum:params globalenv=
$globalenv / ::globalenv=$::globalenv"
}
$baseurl = $globalenv ? {
'int' => 'http://testing.priv.net',
default => 'http://production.priv.net',
}
}
class yum(
$baseurl = $yum::params::baseurl,
$centosversion = "current"
) inherits yum::params {
I'm mixing the the "sane parameter default" pattern with global
variables. We'll see whether that leads to something useful but my
issue right know is that $globalenv and $::globalenv do not evaluate
to the same value.
Here's what Notify[yum-params] displays:
notice: /Stage[main]/Yum::Params/Notify[yum-params]/message:
current_value absent, should be yum:params
globalenv=int / ::globalenv=prod (noop)
It seems $::globalenv evaluates to the top-level scope/value while
$globalenv returns the "overridden" value. Is that the expected
behavior ? Am I missing something ?
I'm running puppet 2.6.16.
Thanks !
G
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
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.