Issue #4717 has been updated by Dan Urist.
I've tried it with 2.6.1rc4, and I'm still seeing the same behavior. I don't
have time to reinstall 0.25, but this definitely worked in 0.25; I used global
variables to set some paths in at least half a dozen manifests. Again, here is
my trivial test case:
/tmp/puppettest/site.pp:
<pre>
$testvar = 'TESTVAR_VALUE'
import '/tmp/puppettest/nodes.pp'
</pre>
/tmp/puppettest/nodes.pp:
<pre>
notice("testvar outside node is: ${testvar}")
node 'test.puppet.cms.ucar.edu' {
notice("testvar inside node is: ${testvar}")
}
</pre>
And here are the log entries:
<pre>
Sep 13 08:53:08 npuppet puppet-master[23724]: (Scope(Class[main])) testvar
outside node is:
Sep 13 08:53:08 npuppet puppet-master[23724]:
(Scope(Node[test.puppet.cms.ucar.edu])) testvar inside node is: TESTVAR_VALUE
</pre>
To reiterate, the variable WAS set in 0.25.
FWIW, I don't need this functionality anymore (I'm now using sub-modules, which
are a cleaner solution for what I was trying to do), but I think it's a
significant change that should at least be documented, and frankly it doesn't
make sense to me that the global variable isn't set in global scope!
----------------------------------------
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.