Issue #4717 has been updated by Nan Liu.

Simple test case:

site.pp:
    testvar = 'foo'
    import a.pp
    include a
    import b.pp

a.pp:
    class a {
      notice ("In class a, testvar is ${testvar})
    }

b.pp:
    notice ("In b, testvar is ${testvar})

Result
    In class a, testvar is foo
    In b, testvar is

This is the same behavior on 0.25.5 and 2.6.1rc4, so please provide more 
information.
----------------------------------------
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.

Reply via email to