Hi, I have been struggling with arrays in puppet in combination with Augeas. I have written a define to configure network interfaces on Debian based distributions using Augeas. One of the requirements is the possibility to use the up/down mechanism.
This where I run into a snag. Everything works fine until I try to setup more than than one up rule. First some code examples of the define: -- Node Configuration -- networking::managed_interface { 'eth1': int => 'eth1', ipaddr => '192.168.1.123', netmask => '255.255.255.0', up => 'route add -net 172.16.1.0/24 gw 192.168.1.1' } -- networking::managed_interface (only the up segment) -- if $up != '' { augeas{ "up-${device}" : context => '/files/etc/network/interfaces', changes => [ "set iface[. = '${device}']/up[. = '${up}' ] \"${up} \"", ], } } So this works fine but I would like to be able to add multiple up rules. I was thinking about passing multiple rules as an array: up => ['route add -net 172.16.1.0/24 gw 192.168.3.1', 'route add -net 192.168.12.0/24 gw 192.168.3.1'] And use some kind of for/while loop in Puppet to iterate over the array but to my surprise Puppet has no way of doing this... I searched the documentation, google and the google-group but there seems to be no way of iterating over an array or even get the size of an array. So now I am kind of stuck. I could write a separate define for the up rules but I would rather have this within the define for interfaces. I am probably not the first to have run into this and I am curious as how others have solved this "problem" Regards, Adrian. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.