Issue #6744 has been reported by Daniel Grafe.
----------------------------------------
Bug #6744: Multidimensional Array passed to template will be flattened
https://projects.puppetlabs.com/issues/6744
Author: Daniel Grafe
Status: Unreviewed
Priority: Normal
Assignee:
Category:
Target version:
Affected Puppet version: 2.6.5
Keywords:
Branch:
We are writing several routes like this:
define route::multiple( $routes) {
file { "routes":
name => $operatingsystem ? {
SLES => "/etc/sysconfig/network/routes",
RedHat =>
"/etc/sysconfig/network-scripts/routes"
},
ensure => present,
content => template("net/ifroute_multiple.erb"),
}
}
Calling the definition like that:
net::route::multiple { "Additional routes":
routes => [
[ '10.30.0.0',
'10.30.33.20', '255.255.255.0', 'bond0' ],
[ '10.30.32.0',
'239.30.10.2' ,'255.255.255.240', 'bond0' ],
[ '10.30.7.14',
'239.30.110.2','255.255.255.240', 'eth4' ],
[ '194.49.199.0',
'10.30.33.10', '255.255.255.0', 'bond0' ],
[ '194.49.239.0',
'10.30.33.10', '255.255.255.0', 'bond0' ]
]
}
The multidimensional array will be expanded in the template:
#######################################################
### /etc/sysconfig/network/routes (<%= name %>)
#######################################################
# destination gateway genmask device
<% routes.each do |r| -%>
<%= r[0] %> <%= r[1] %> <%= r[2] %> <%= r[3] %>
<% end-%>
With puppet Version 2.6.3 the result was a valid routes file with every line
defining a route. We have now moved to puppet 2.6.5 and the result is a file
with completely cluttered entries. The enclosing array seems to be "flattened",
it is no longer an array of arrays with 4 components each but it is just one
serialized array. Iterating this array as shown above resulst in misinterpreted
values:
#######################################################
### /etc/sysconfig/network/routes (Additional routes)
#######################################################
# destination gateway genmask device
49 48 46 51
49 48 46 51
50 53 53 46
98 111 110 100
--
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.