Issue #13323 has been updated by Chris Price.

File 13323.pp added
Status changed from Investigating to Needs More Information
Assignee changed from Chris Price to Trevor Vaughan
Priority changed from High to Normal

Trevor,

Can you perhaps attach a manifest that I can run "apply" on to illustrate the 
problems you're describing?  I've attached one that I was playing with to try 
to come up with a repro case, and I when I attempt to apply it I get this error:

    Could not parse for environment production: Cannot assign to variables in 
other namespaces at /my/path/13323.pp:7 on node cosmicshame.puppetlabs.lan

I get similar errors if I try to copy and paste from the code snippets that 
you've provided here, and I want to make sure that we understand exactly where 
the scoping issues are impacting you before attempting to diagnose further.

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

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