I use a puppet to create a set of constants for a ruby program. I need to provide an array of host names over which my program will iterate.
In the bash script that I used before, I just had as a puppet variable
hosts => "host1,host2"
which I provided a bash script like
HOSTS=<%= hosts %>
obviously this will not work for ruby - I need this in the format
hosts = ["host1","host2"]
as
p hosts
and
puts my_array.inspect
provide a conclusion
["host1","host2"]
I was hoping to use one of them. Unfortunately, I can’t understand in my entire life how to do this. I tried each of the following:
<% p hosts %>
<% puts hosts.inspect %>
I found somewhere where they indicated that I would need to put "function_" before the function calls ... which does not seem to work. I decided to use an iterative model:
[<% hosts.each do |host| -%>"<%=host%>",<% end -%>]
it works by giving me
["host1","host2",]
. . - ? ?