I thought I read in some documentation somewhere that for array variables you had a means of setting up a conditional for "last element". For instance class foo { $hosts=[''hosta'',''hostb'',''hostc''] file { some-config : path=>"/s/ome/path/2[image: Call phone]/ Invited♫ Invited♫ Invited♫ Invited♫ Invited♫ Invited♫ my/file", content => template("mytemplaste.erb") } } and the template <% hosts.each do |host| -%><% if_not_last_element %><%= host %>, <% end %> <% if_last_element %><%= host %><% end %> The result should end up as hosta,hostb,hostc Did I dream that or am I mixing up other templating tools I''ve used? -- Peter L. Berghold Owner, Shark River TechnicalSolutions LLC -- 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.
Peter, I''m not sure about your specific question but there is a much easier way of doing what you are trying to do. <%= hosts.join('','') %> That will replace your entire example template. :) On Sep 24, 2:33 pm, Peter Berghold <salty.cowd...@gmail.com> wrote:> I thought I read in some documentation somewhere that for array variables > you had a means of setting up a conditional for "last element". > > For instance > > class foo { > $hosts=[''hosta'',''hostb'',''hostc''] > file { some-config : > path=>"/s/ome/path/2[image: Call phone]/ Invited♫ > Invited♫ Invited♫ Invited♫ Invited♫ Invited♫ my/file", > content => template("mytemplaste.erb") > } > > } > > and the template > > <% hosts.each do |host| -%><% if_not_last_element %><%= host %>, <% end %> > <% if_last_element %><%= host %><% end %> > > The result should end up as > > hosta,hostb,hostc > > Did I dream that or am I mixing up other templating tools I''ve used? > > -- > Peter L. Berghold > Owner, Shark River TechnicalSolutions LLC-- 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.
Hmmm.... looks suspiciously Perl-ish. ;) On Sep 24, 2011 4:19 PM, "Steve Snodgrass" <pheran@gmail.com> wrote: Peter, I''m not sure about your specific question but there is a much easier way of doing what you are trying to do. <%= hosts.join('','') %> That will replace your entire example template. :) On Sep 24, 2:33 pm, Peter Berghold <salty.cowd...@gmail.com> wrote:> I thought I read in some docu...-- 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 must be new to Ruby. On Sep 24, 2011 3:30 PM, "Peter Berghold" <salty.cowdawg@gmail.com> wrote:> Hmmm.... looks suspiciously Perl-ish. ;) > > On Sep 24, 2011 4:19 PM, "Steve Snodgrass" <pheran@gmail.com> wrote: > > Peter, I''m not sure about your specific question but there is a much > easier way of doing what you are trying to do. > > <%= hosts.join('','') %> > > That will replace your entire example template. :) > > > On Sep 24, 2:33 pm, Peter Berghold <salty.cowd...@gmail.com> wrote: >> I thought I read in some docu... > -- > 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 topuppet-users+unsubscribe@googlegroups.com.> For more options, visit this group athttp://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.