Issue #9518 has been updated by Nigel Kersten.

(2) feels like the right approach, but I'm concerned about breakage.

I can't imagine why people would adopt a pattern that this broke, but it's 
entirely possible :(
----------------------------------------
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