Hi, I''m struggling to get this to work and don''t understand where I''m going wrong, can someone please guide me on how to correct? Basically I want to get an array in my nodes.pp, which is then used by my templates file by cycling through it and writing a line of each element: nodes.pp: node test{ net::addr { ''routing'': routes = [ { address => ''0.0.0.0'', netmask => ''0.0.0.0'', gateway => ''169.32.68.33'', dev => ''eth0'', }, { address => ''192.168.1.3'', netmask => ''255.255.255.0'', gateway => ''192.168.1.1'', dev => ''eth3'', }, ] } } When I run the puppet client i keep getting the following: err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not parse for environment production: Syntax error at ''=''; expected ''}'' at /etc/puppet/manifests/nodes/test.pp:3 on node test.myincorp.net Can someone please help? Thanks Dan -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Hi, I''m struggling to get this to work and don''t understand where I''m going wrong, can someone please guide me on how to correct? Basically I want to get an array in my nodes.pp, which is then used by my templates file by cycling through it and writing a line of each element: nodes.pp: node test{ net::addr { ''routing'': routes = [ { address => ''172.29.54.70'', netmask => ''255.255.255.0'', gateway => ''172.29.54.65'', dev => ''eth0'', }, { address => ''192.168.1.3'', netmask => ''255.255.255.0'', gateway => ''192.168.1.1'', dev => ''eth3'', }, ] } } When I run the puppet client i keep getting the following: err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not parse for environment production: Syntax error at ''=''; expected ''}'' at /etc/puppet/manifests/nodes/ test.pp:3 on node test.myincorp.net Can someone please help? Thanks Dan -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
On Thursday, February 14, 2013 9:02:01 AM UTC-6, Dan wrote:> > Hi, > > I''m struggling to get this to work and don''t understand where I''m going > wrong, can someone please guide me on how to correct? > > Basically I want to get an array in my nodes.pp, which is then used by my > templates file by cycling through it and writing a line of each element: > > nodes.pp: > node test{ > net::addr { ''routing'': > routes = [ > { > address => ''172.29.54.70'', > netmask => ''255.255.255.0'', > gateway => ''172.29.54.65'', > dev => ''eth0'', > }, > { > address => ''192.168.1.3'', > netmask => ''255.255.255.0'', > gateway => ''192.168.1.1'', > dev => ''eth3'', > }, > ] > } > } > When I run the puppet client i keep getting the following: > > err: Could not retrieve catalog from remote server: Error 400 on SERVER: > Could not parse for environment production: Syntax error at ''=''; expected > ''}'' at /etc/puppet/manifests/nodes/ > test.pp:3 on node test.myincorp.net > >Your data structure is wrong, you have something that is somewhere between a hash and and array. If "routes" is the name of the param for the net::addr define, then you need to use: routes => and not routes Without seeing the full code (net::addr AND the template in question), it''s hard to say what the best total fix is, but I suspect moving things into a hash of hashes and calling create_resources() may be one of the best options.> Can someone please help? > > Thanks > Dan >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
On Thursday, February 14, 2013 3:12:59 PM UTC, llowder wrote:> > > > On Thursday, February 14, 2013 9:02:01 AM UTC-6, Dan wrote: >> >> Hi, >> >> I''m struggling to get this to work and don''t understand where I''m going >> wrong, can someone please guide me on how to correct? >> >> Basically I want to get an array in my nodes.pp, which is then used by my >> templates file by cycling through it and writing a line of each element: >> >> nodes.pp: >> node test{ >> net::addr { ''routing'': >> routes = [ >> { >> address => ''172.29.54.70'', >> netmask => ''255.255.255.0'', >> gateway => ''172.29.54.65'', >> dev => ''eth0'', >> }, >> { >> address => ''192.168.1.3'', >> netmask => ''255.255.255.0'', >> gateway => ''192.168.1.1'', >> dev => ''eth3'', >> }, >> ] >> } >> } >> When I run the puppet client i keep getting the following: >> >> err: Could not retrieve catalog from remote server: Error 400 on SERVER: >> Could not parse for environment production: Syntax error at ''=''; expected >> ''}'' at /etc/puppet/manifests/nodes/ >> test.pp:3 on node test.myincorp.net >> >> > Your data structure is wrong, you have something that is somewhere between > a hash and and array. > > If "routes" is the name of the param for the net::addr define, then you > need to use: > > routes => > > and not > > routes > > Without seeing the full code (net::addr AND the template in question), > it''s hard to say what the best total fix is, but I suspect moving things > into a hash of hashes and calling create_resources() may be one of the best > options. > > > >> Can someone please help? >> >> Thanks >> Dan >> >net::addr define net::addr ( $address='''', $netmask='''', $gateway='''', $dev='''', ) { file { "route-${name}": ensure => ''present'', mode => ''0644'', owner => ''root'', group => ''root'', path => "/etc/sysconfig/network-scripts/route-${name}", content => template(''network/addr.erb''), } } Template: addr.erb: <% routes.each do |route| -%> <%= route[''address''] %> <%= route[''netmask''] %> <%= route[''gateway''] %> <%= route[''dev''] %> <% end -%> <% end -%> <% end -%> Any thoughts on what I can do, I''m still relatively new to puppet programming. thanks Dan -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
On 14.02.2013 15:58, Dan wrote:> Hi, > > I''m struggling to get this to work and don''t understand where I''m going > wrong, can someone please guide me on how to correct? > > Basically I want to get an array in my nodes.pp, which is then used by > my templates file by cycling through it and writing a line of each element: > > nodes.pp: > node test{ > net::addr { ''routing'': > routes = [its "routes => [" Regards, D. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.