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 <[email protected]> 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 [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-users?hl=en.