Issue #9518 has been updated by Daniel Pittman.

I have checked, and this behaviour actually goes all the way back to the very 
first introduction of the feature; it has always returned the mutated top-scope 
variable. I suspect this is because there are not really "nested" values, only 
scoped name/value bindings, so the result finds the most local variable with 
the name test.

I think you have successfully discovered an "undefined" behaviour, but I can 
validate that it occurs. Thanks for the report.

----------------------------------------
Bug #9518: Array scope different from string scope:
https://projects.puppetlabs.com/issues/9518

Author: Zach Leslie
Status: Accepted
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 2.7.1
Keywords: 
Branch: 


The following code:

<pre>
$var=["top"]

class test1 { 
$var+=["test1"] 
} 
class test2 { 
$var+=["test2"] 
notice("Top: $::var Test1: ${test1::var} Test2: ${test2::var}") 
}

class{ "test1": } 
class{ "test2": }
</pre>

produces:
<pre>
notice: Scope(Class[Test2]): Top: top Test1: toptest1 Test2: toptest2
</pre>

If the array is changed to a string as such:

<pre>
$var="top"

class test1 { 
$var+="test1" 
} 
class test2 { 
$var+="test2" 
notice("Top: $::var Test1: ${test1::var} Test2: ${test2::var}") 
}

class{ "test1": } 
class{ "test2": }
</pre>

The behavior changes.
<pre>
notice: Scope(Class[Test2]): Top: toptest1test2 Test1: toptest1test2 Test2: 
toptest1test2
</pre>


This appears to be inconsistent scoping and should be fixed.  I've been 
informed that its been around for a long time.  Tested on 2.7.1 and 2.7.4. 



-- 
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