Issue #1048 has been updated by James Turnbull.

Target version deleted (unplanned)


----------------------------------------
Feature #1048: can't build an array of arrays directly
https://projects.puppetlabs.com/issues/1048

Author: Martha Greenberg
Status: Accepted
Priority: Normal
Assignee: 
Category: language
Target version: 
Affected Puppet version: 0.24.8
Keywords: 
Branch: 


You should be able to create an array of arrays directly ([[1,2],[3,4]]).  
Right now, puppet flattens that out to a single array ([1,2,3,4]).  Doing this 
via variables does work ($a=[1,2];$b=[3,4];$array=[$a,$b]).

<pre>
het:/tmp# cat /tmp/test.erb
<% aliases.each do |src,dest| -%>
test <%= src %> foo <%= dest %>
<% end -%>
het:/tmp# cat /tmp/etest.pp
$aliases = [[[1" 3]["2]]
file { "/tmp/output":
        content => template("/tmp/test.erb")
}
het:/tmp# puppet etest.pp
notice: //File[/tmp/output]/content: created file with contents 
{md5}136e6a9ed28256274b16de7ba9e1d7e1
het:/tmp# cat /tmp/output
test /1 foo
test 3 foo
test /2 foo
test 5 foo
het:/tmp# cat /tmp/etest2.pp
$a1 = [r1]
$a2 = [r2]
$aliases = [$a1,$a2]
file { "/tmp/output":
        content => template("/tmp/test.erb")
}
het:/tmp# puppet etest2.pp
notice: //File[/tmp/output]/content: changed file contents from 
{md5}136e6a9ed28256274b16de7ba9e1d7e1 to {md5}3b6c1fb2cd842043cf66266f59cb2d88

het:/tmp# cat /tmp/output fg
test /1 foo 3
test /2 foo 5


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