Issue #13323 has been updated by Trevor Vaughan.

Assignee changed from Trevor Vaughan to Chris Price


----------------------------------------
Bug #13323: Issues with variable scoping.
https://projects.puppetlabs.com/issues/13323#change-58743

Author: Trevor Vaughan
Status: Needs More Information
Priority: Normal
Assignee: Chris Price
Category: 
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.

Reply via email to