On Thu, 02 Sep 2010 23:32:43 +0200
  Peter Meier <[email protected]> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>> I have another glitch with 2.6.1-rc2 that worked in 0.25-- I set a
>> global variable in my site.pp that is used in my nodes.pp, but it's
>>no
>> longer set there, though it still is in my modules. Is this a bug,
>>or a
>> design change?
>
> I have a similar setup that works. But do you set it before or after
>you
> import nodes.pp?
> And do you have a minimal setup that reproduces that?

I've done a little bit more digging, and it looks like the variable is
set within a node definition, but not outside it.

site.pp:

> $testvar = "TESTVAR_VALUE"
> import "nodes"

nodes.pp:

> notice("testvar outside node is: ${testvar}")
> node 'test.puppet.cms.ucar.edu' {
> notice("testvar inside node is: ${testvar}")
> }

In my logs, I get:

> puppet-master[3757]: (Scope(Class[main])) testvar outside node is:
> puppet-master[3757]: (Scope(Node[test.puppet.cms.ucar.edu])) testvar
inside node is: TESTVAR_VALUE

If I then attempt to assign the variable in nodes.pp, 
but outside of the node definition, I get an error:

nodes.pp:

> $testvar = "TESTVAR_SET_IN_NODES"
> notice("testvar outside node is: ${testvar}")
> node 'test.puppet.cms.ucar.edu' {
>   notice("testvar inside node is: ${testvar}")
> }

Here's the error log entry:

> puppet-master[3754]: (Scope(Class[main])) testvar outside node is:
TESTVAR_SET_IN_NODES
> puppet-master[3754]: Cannot reassign variable testvar at
/usr/local/puppet/dev/site.pp:18 on node test.puppet.cms.ucar.edu
> puppet-master[3754]: Cannot reassign variable testvar at
/usr/local/puppet/dev/site.pp:18 on node test.puppet.cms.ucar.edu

So it looks like there are two different scopes now? In 0.25, I was
setting the variable outside of the node definition; I was using 
this to set some path variables. Is this a bug, or was this change 
intended?

-- 
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.

Reply via email to