Hi all, Is it possible to manage List of list within Puppet ? I''d like to use something like this : interfaces = [ [ "eth0", "192.168.120.65", "255.255.255.0", "192.168.120.255", "true" ], [ "eth0:0", "192.168.120.66", "255.255.255.0", "192.168.120.255", "true" ] ] When looping over element in a template, I''m getting elements like if it was one list : <% interfaces.each do |iface| -%> #param <%= iface %> <% end -%> #param eth0 #param 192.168.120.65 #param 255.255.255.0 #param 192.168.120.255 #param true #param eth0:0 #param 192.168.120.66 #param 255.255.255.0 #param 192.168.120.255 #param true Thanks for your help. Serge. -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
As far as I know this should work. There was a regression in 0.24.6 that broke it though. Which version are you running? On 2 Apr 2010, at 14:55, Serge Dewailly <serge.dewailly@openevents.fr> wrote:> Hi all, > > Is it possible to manage List of list within Puppet ? > I''d like to use something like this : > > interfaces = [ [ "eth0", "192.168.120.65", "255.255.255.0", "192.168.120.255 > ", "true" ], [ "eth0:0", "192.168.120.66", "255.255.255.0", "192.168.120.255 > ", "true" ] ] > > When looping over element in a template, I''m getting elements like > if it was one list : > > <% interfaces.each do |iface| -%> > #param <%= iface %> > <% end -%> > > #param eth0 > #param 192.168.120.65 > #param 255.255.255.0 > #param 192.168.120.255 > #param true > #param eth0:0 > #param 192.168.120.66 > #param 255.255.255.0 > #param 192.168.120.255 > #param true > > > Thanks for your help. > Serge. > > -- > 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+unsubscribe@googlegroups.com > . > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en > . >-- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Hi, I''m using 0.24.1. Maybe an upgrade would make it working ? Serge. Le 02/04/10 16:25, Mike Pountney a écrit :> As far as I know this should work. There was a regression in 0.24.6 that > broke it though. Which version are you running? > > > On 2 Apr 2010, at 14:55, Serge Dewailly <serge.dewailly@openevents.fr> > wrote: > >> Hi all, >> >> Is it possible to manage List of list within Puppet ? >> I''d like to use something like this : >> >> interfaces = [ [ "eth0", "192.168.120.65", "255.255.255.0", >> "192.168.120.255", "true" ], [ "eth0:0", "192.168.120.66", >> "255.255.255.0", "192.168.120.255", "true" ] ] >> >> When looping over element in a template, I''m getting elements like if >> it was one list : >> >> <% interfaces.each do |iface| -%> >> #param <%= iface %> >> <% end -%> >> >> #param eth0 >> #param 192.168.120.65 >> #param 255.255.255.0 >> #param 192.168.120.255 >> #param true >> #param eth0:0 >> #param 192.168.120.66 >> #param 255.255.255.0 >> #param 192.168.120.255 >> #param true >> >> >> Thanks for your help. >> Serge. >> >> -- >> 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+unsubscribe@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/puppet-users?hl=en. >> >-- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
you can do something like this instead: in your manifest: $ifs = "eth0, 192.168.120.65, 255.255.255.0, 192.168.120.255, true; eth0:0, 192.168.120.66, 255.255.255.0, 192.168.120.255, true" file {"xxx": content => template("xxx.erb")} and in your template: <% ifs.split(";").each do |int| -%> <% name, ip, mask, bcast, enable = int.split(",").map{|s| s.strip} %> name: <%= name %> ip: <%= ip %> mask: <%= mask %> bcast: <%= bcast %> enabled: <%= enable %> <% end -%> Ohad On Fri, Apr 2, 2010 at 9:55 PM, Serge Dewailly <serge.dewailly@openevents.fr> wrote:> Hi all, > > Is it possible to manage List of list within Puppet ? > I''d like to use something like this : > > interfaces = [ [ "eth0", "192.168.120.65", "255.255.255.0", > "192.168.120.255", "true" ], [ "eth0:0", "192.168.120.66", "255.255.255.0", > "192.168.120.255", "true" ] ] > > When looping over element in a template, I''m getting elements like if it > was one list : > > <% interfaces.each do |iface| -%> > #param <%= iface %> > <% end -%> > > #param eth0 > #param 192.168.120.65 > #param 255.255.255.0 > #param 192.168.120.255 > #param true > #param eth0:0 > #param 192.168.120.66 > #param 255.255.255.0 > #param 192.168.120.255 > #param true > > > Thanks for your help. > Serge. > > -- > 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+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > >-- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
I''m not really able to check at the moment, but i''m pretty sure the issue is fixed in 0.24.8, so you might want to try that first. We had a bunch of issues with our manifests (quality issues at our end mainly btw) going to 0.25.x, but of course it''s best if you can get your puppetmaster at least onto the latest version. All template interpolation is done on the PM, so there''s no need to update your clients to fix this issue in particular. On 2 Apr 2010, at 15:27, Serge Dewailly <serge.dewailly@openevents.fr> wrote:> Hi, > > I''m using 0.24.1. Maybe an upgrade would make it working ? > Serge. > > Le 02/04/10 16:25, Mike Pountney a écrit : >> As far as I know this should work. There was a regression in 0.24.6 >> that >> broke it though. Which version are you running? >> >> >> On 2 Apr 2010, at 14:55, Serge Dewailly >> <serge.dewailly@openevents.fr> >> wrote: >> >>> Hi all, >>> >>> Is it possible to manage List of list within Puppet ? >>> I''d like to use something like this : >>> >>> interfaces = [ [ "eth0", "192.168.120.65", "255.255.255.0", >>> "192.168.120.255", "true" ], [ "eth0:0", "192.168.120.66", >>> "255.255.255.0", "192.168.120.255", "true" ] ] >>> >>> When looping over element in a template, I''m getting elements like >>> if >>> it was one list : >>> >>> <% interfaces.each do |iface| -%> >>> #param <%= iface %> >>> <% end -%> >>> >>> #param eth0 >>> #param 192.168.120.65 >>> #param 255.255.255.0 >>> #param 192.168.120.255 >>> #param true >>> #param eth0:0 >>> #param 192.168.120.66 >>> #param 255.255.255.0 >>> #param 192.168.120.255 >>> #param true >>> >>> >>> Thanks for your help. >>> Serge. >>> >>> -- >>> 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+unsubscribe@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/puppet-users?hl=en. >>> >> > > -- > 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+unsubscribe@googlegroups.com > . > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en > . >-- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Upgrading version to last one (0.25.5) didn''t help, and downgrade to 0.24 is not possible due to 0.25 fonctionalities'' use (I''m using 0.25.5 debian package now). But I have found a solution, based on Ohad''s one : $interfaces = [ "eth0,192.168.120.65,255.255.255.0,192.168.120.255,true", "eth1,192.168.120.65,255.255.255.0,192.168.120.255,false" ] <% interfaces.each do |iface| -%> <% name, ip, mask, bcast, gw = iface.split(",").map{|s| s.strip} %> auto <%= name %> iface <%= name %> inet static address <%= ip %> netmask <%= mask %> broadcast <%= bcast %> <% if gw == "true" %>gateway <%= gateway %><% end -%> <% end -%> (which produce an acceptable interfaces for debian) Thanks for everyone''s help ! Serge. Le 02/04/10 16:38, Mike Pountney a écrit :> I''m not really able to check at the moment, but i''m pretty sure the > issue is fixed in 0.24.8, so you might want to try that first. We had a > bunch of issues with our manifests (quality issues at our end mainly > btw) going to 0.25.x, but of course it''s best if you can get your > puppetmaster at least onto the latest version. > > All template interpolation is done on the PM, so there''s no need to > update your clients to fix this issue in particular. > > On 2 Apr 2010, at 15:27, Serge Dewailly <serge.dewailly@openevents.fr> > wrote: > >> Hi, >> >> I''m using 0.24.1. Maybe an upgrade would make it working ? >> Serge. >> >> Le 02/04/10 16:25, Mike Pountney a écrit : >>> As far as I know this should work. There was a regression in 0.24.6 that >>> broke it though. Which version are you running? >>> >>> >>> On 2 Apr 2010, at 14:55, Serge Dewailly <serge.dewailly@openevents.fr> >>> wrote: >>> >>>> Hi all, >>>> >>>> Is it possible to manage List of list within Puppet ? >>>> I''d like to use something like this : >>>> >>>> interfaces = [ [ "eth0", "192.168.120.65", "255.255.255.0", >>>> "192.168.120.255", "true" ], [ "eth0:0", "192.168.120.66", >>>> "255.255.255.0", "192.168.120.255", "true" ] ] >>>> >>>> When looping over element in a template, I''m getting elements like if >>>> it was one list : >>>> >>>> <% interfaces.each do |iface| -%> >>>> #param <%= iface %> >>>> <% end -%> >>>> >>>> #param eth0 >>>> #param 192.168.120.65 >>>> #param 255.255.255.0 >>>> #param 192.168.120.255 >>>> #param true >>>> #param eth0:0 >>>> #param 192.168.120.66 >>>> #param 255.255.255.0 >>>> #param 192.168.120.255 >>>> #param true >>>> >>>> >>>> Thanks for your help. >>>> Serge. >>>> >>>> -- >>>> 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+unsubscribe@googlegroups.com. >>>> For more options, visit this group at >>>> http://groups.google.com/group/puppet-users?hl=en. >>>> >>> >> >> -- >> 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+unsubscribe@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/puppet-users?hl=en. >> >-- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.