Issue #13323 has been updated by Chris Price. File 13323-1.pp added File 13323-2.pp added Category set to language Status changed from Investigating to Needs Decision Assignee changed from Chris Price to Pieter van de Bruggen
Trevor, thanks, this helps clear up what you were seeing. This is, currently, the expected behavior. Variable/name resolution for any variable that isn't prefixed with a leading "::" will look in the current namespace first, and then the global namespace. Whether or not this is the best long-term behavior is a different question; handing this off to our design team, who are scheduled to do some work on our DSL soon. The two attached manifest files demonstrate the scope confusion; the second one is identical to the first, but with the "bar::foo" class commented out to demonstrate how the scope resolution is affected. ---------------------------------------- Bug #13323: Issues with variable scoping. https://projects.puppetlabs.com/issues/13323#change-59033 Author: Trevor Vaughan Status: Needs Decision Priority: Normal Assignee: Pieter van de Bruggen Category: language Target version: Affected Puppet version: 2.7.12 Keywords: ambiguity, variable, scope Branch: According to http://docs.puppetlabs.com/guides/scope_and_puppet.html, we should be attempting to use fully qualified variable scoping across the board. However, I've run into a situation where there appear to be some serious issues. Example: class foo ($var1 = 'something') {} class foo::baz { if $foo::var1 == 'something' { do something } } class bar { $foo::var1 <- does not exist because it looks in bar::foo class { '::foo': var1 => 'baz' } } class bar::foo { stuff... } The issue is that $::foo::var1 is NOT the same as $foo::var1 though both can be successfully declared anywhere across the manifest space. This causes very non-deterministic actions when using both variants though they should both really be the same thing. So, what is correct? Should we always use $::variable::thing or is the code incorrect and they should both be valid at the top scope when there is no lower scope overriding that variable? -- 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.
