Hi folks,
I'm using an ERB template to write out a chunk of config file. The key
line of the template is this:
members=<% @members.each_pair do |key, value| -%><%= key -%>;<%=
value['service'] -%>;<%= value['opt'] -%>, <% end %>
and it produces this output:
members=radius-local01.example.com;RADIUS;&,
radius-local02.example.com;RADIUS;&, radius-local03.example.com;RADIUS;&,
However, both the 'service' and 'opt' tags are optional so I wrapped
them in conditionals like this:
members=<% @members.each_pair do |key, value| -%><%= key -%><% if
value['service'] %>;<%= value['service'] %><% end %><% if value['opt']
%>;<%= value['opt']%><% end %>, <% end %>
But this resulted in value['service'] being printed as a literal string.
What have I done wrong?
members=db1.example.com;value['service'];value['opt'],db2.example.com;value['service'];value['opt'],db3.example.com;value['service'];value['opt'],
Any hints would be appreciated!
Thanks,
Jonathan
--
Jonathan Gazeley
Senior Systems Administrator
IT Services
University of Bristol
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/9643c74c-a211-29d2-b175-94b453d1469e%40bristol.ac.uk.
For more options, visit https://groups.google.com/d/optout.