Issue #20970 has been reported by Daniele Sluijters.
----------------------------------------
Feature #20970: Scopes for node variables and facts
https://projects.puppetlabs.com/issues/20970
* Author: Daniele Sluijters
* Status: Unreviewed
* Priority: Normal
* Assignee:
* Category: language
* Target version:
* Affected Puppet version:
* Keywords: fact, facter, node, node variable, variable, scope, scoping
* Branch:
----------------------------------------
Currently, variables declared on the node still magically appear in your local
scope but can't be accessed as a top-scope variable.
So:
<pre><code>
node default {
$var = 'a'
}
</code></pre>
Now, in every module, template, anywhere, ```$var``` will exist with a value of
```a``` unless overwritten in the local scope (I think).
It would be nice if we could confine node level variables to their own scope,
so we can access it like ```$::nodevar::var``` instead of ```$var``` and don't
have a ```$var``` in our local scope unless we happen to define it there.
I think it would lead to problems if the node level variables where
automatically made part of the global scope since names might start to clash
with facts and other things.
Perhaps it would be wise to put facts in their own scope to,
```$::fact::osfamily```, which also immediately makes it a lot more obvious in
the code (especially to newcomers) where that variable comes from.
--
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.