Issue #2988 has been updated by Michael Stahnke.

Description updated
Status changed from Unreviewed to Closed

This appears to be fixed in 2.7.9


    [root@centos foo]# cat manifests/init.pp 
    class foo { 
    $a = ['a1', 'a2']
    $b = ['b1', 'b2']
    # c is not flattened
    $c = [$a, $b]
    # d is flattened
    $d = [['a1', 'a2'], ['b1', 'b2']]
    file {'/tmp/dan':
    content => template('foo/dan.erb'),
    }
    }
    [root@centos foo]# cat templates/dan.erb 
    <% c.each do |val| -%>
    c val: <%= val %>
    <% end -%>
    <% d.each do |val| -%>
    d val: <%= val %>
    <% end -%>
    [root@centos foo]# !pup
    puppet apply --verbose --modulepath=.. -e 'include foo'
    dnsdomainname: Unknown host
    info: Applying configuration version '1327172604'
    notice: Finished catalog run in 0.03 seconds
    [root@centos foo]# cat /tmp/dan 
    c val: a1a2
    c val: b1b2
    d val: a1a2
    d val: b1b2
    [root@centos foo]# 
    
----------------------------------------
Feature #2988: inconsistent array flattening
https://projects.puppetlabs.com/issues/2988

Author: Dan Bode
Status: Closed
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 0.25.1
Keywords: 
Branch: 


arrays are not flattened when defined using array variables, but they are 
flattened when arrays are defined in the array.

I wanted at least document this inconsistent behavior, below, c != d (at least 
from the perspective of templates). 

#test.pp
<pre>
$a = ['a1', 'a2']
$b = ['b1', 'b2']
# c is not flattened
$c = [$a, $b]
# d is flattened
$d = [['a1', 'a2'], ['b1', 'b2']]
file {'/tmp/arrayflattest':
  content => template('/etc/puppet/templates/arrayflattest.erb'),
}
</pre>
#arrayflattest.pp
<pre>
<% c.each do |val| -%>
c val: <%= val %>
<% end -%>
<% d.each do |val| -%>
d val: <%= val %>
<% end -%>
</pre>
#arrayflattest
<pre>
c:a1a2
c:b1b2
d:a1
d:a2
d:b1
d:b2
</pre>


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