Issue #20124 has been updated by Charlie Sharpsteen.

Status changed from Unreviewed to Rejected

>From the [documentation on import statements][import]:

> They are processed before any other code in the manifest is parsed

The value of `$::foo` is undefined during the processing of `test2` because the 
Puppet code in `hello.pp` is processed before the code in `site.pp` that 
defines `$foo = false`.

[import]: http://docs.puppetlabs.com/puppet/3/reference/lang_import.html


----------------------------------------
Bug #20124: $global variables don't seem to work properly
https://projects.puppetlabs.com/issues/20124#change-88933

* Author: James Shubin
* Status: Rejected
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
* Affected Puppet version: 
* Keywords: 
* Branch: 
----------------------------------------
<pre>
Hi there,

It seems I've stumbled upon a bug with global variables:

#/etc/puppet/manifests/site.pp

$foo = false
notify { 'test1':
        message => $::foo ? {
                true => 'true',
                false => 'false', # THIS PRINTS
                default => 'default',
        },
}

import 'hello.pp'
import 'nodes/*.pp'

#####################################################################

#/etc/puppet/manifests/hello.pp

notify { 'test2':
        message => $::foo ? {
                true => 'true',
                false => 'false', # XXX: I EXPECT THIS, BUT INSTEAD:
                default => 'default', # THIS PRINTS
        },
}

I'm using the latest 3.x puppet from the yum puppetlabs repo.
Cheers,
James


</pre>



-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to