Issue #20970 has been updated by Daniele Sluijters.
Yes, that's pretty much what I'm asking. Facts could stay in the top scope but I think it's nice to have things namespaced, it makes it much clearer where you're getting your data from. With 2.7/3.0 a big point was made about removing the magic around variable scoping but the node's anynomous scope remained which a lot of people take to be a form of variable scoping. Though this is now fairly well documented it's an odd one out and does tend to lead to confusion. I think it would be nice to extend that trend to the other slightly magical appearance of variables in the top scope and the node's anonymous scope and give them their own space. ---------------------------------------- Feature #20970: Scopes for node variables and facts https://projects.puppetlabs.com/issues/20970#change-91935 * Author: Daniele Sluijters * Status: Needs More Information * Priority: Normal * Assignee: Daniele Sluijters * 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.
