On May 18, 11:23 am, Calimero <calimero...@evolutive.org> wrote: > 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" > } > [...] > } > [...] > 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 ?
That is exactly the expected behavior in Puppet 2.7.x and earlier. It is an example of Puppet's dynamic scoping behavior. Resolving variables from dynamic scope is deprecated in 2.7, however, and dynamic scoping will be removed altogether in Telly. A v2.7 master would emit a deprecation warning about your reference to (unqualified) $globalenv where it is not lexically in-scope. Importantly, do note that node variables are NOT globals. Also, node variables do not have qualified names, so the deprecation and eventual removal of dynamic scoping significantly limits their usefulness. John -- 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.