Issue #20970 has been updated by Charlie Sharpsteen.

Status changed from Needs More Information to Needs Decision
Assignee changed from Daniele Sluijters to eric sorenson

One major issue with converting anonymous node scope to a named scope is that 
we would loose a commonly-used method of overriding global variables on a 
per-node basis. This feature request may not be feasible until we have a viable 
replacement for overriding the global namespace. Hiera 2 is currently [under 
development](https://github.com/puppetlabs/armatures/blob/master/arm-8.hiera_2/index.md)
 and may provide the needed alternative, but is still at an early stage of 
development.

Eric, any ideas about this feature request?

----------------------------------------
Feature #20970: Scopes for node variables and facts
https://projects.puppetlabs.com/issues/20970#change-92606

* Author: Daniele Sluijters
* Status: Needs Decision
* Priority: Normal
* Assignee: eric sorenson
* 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.


Reply via email to