Issue #4717 has been updated by Dan Urist.
One more thing... if I add a notice statement to site.pp like this:
<pre>
$testvar = 'TESTVAR_VALUE'
notice("testvar in site.pp is: ${testvar}")
import '/tmp/puppettest/nodes.pp'
</pre>
Then I get the following log entries:
<pre>
Sep 13 09:05:51 npuppet puppet-master[23720]: (Scope(Class[main])) testvar
outside node is:
Sep 13 09:05:51 npuppet puppet-master[23720]: (Scope(Class[main])) testvar in
site.pp is: TESTVAR_VALUE
Sep 13 09:05:51 npuppet puppet-master[23720]:
(Scope(Node[test.puppet.cms.ucar.edu])) testvar inside node is: TESTVAR_VALUE
</pre>
So clearly the variable is set in Scope(Class[main]) in site.pp, but not in
Scope(Class[main]) in nodes.pp? I'm guessing for some reason nodes.pp is
evaluated first? This certainly seems buggy to me...
----------------------------------------
Bug #4717: Global variables are no longer fully global
http://projects.puppetlabs.com/issues/4717
Author: Dan Urist
Status: Needs more information
Priority: Normal
Assignee:
Category:
Target version:
Affected version: 2.6.1rc2
Keywords: global variable scope
Branch:
A variable defined in global scope is no longer visible in the global scope of
other files. For example:
site.pp:
$testvar = "TESTVAR_VALUE"
nodes.pp:
notice("testvar outside node is: ${testvar}")
node 'test.puppet.cms.ucar.edu' {
notice("testvar inside node is: ${testvar}")
}
The log contains this after a puppet run:
puppet-master[3758]: (Scope(Class[main])) testvar outside node is:
puppet-master[3758]: (Scope(Node[test.puppet.cms.ucar.edu])) testvar inside
node is: TESTVAR_VALUE
If I move the node definition to site.pp, so it is in the same file as the
variable definition, then it's defined both outside and inside the node
definition.
I haven't tested whether the same issue exists for classes as well as nodes.
Note that the behavior in 0.25 was that the global variable was defined
everywhere, which is what I would expect (and is the behavior some of my
modules rely on).
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" 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-bugs?hl=en.