0
 /opt/mapr/server/configure.sh -N <%=@clust_name %>  -c -C cldb  -Z <%       @zookeeprall.each do |node| -%> 
    <%= node %>:<%=@zk_p %>
    <% end %> 

zookeeperall is array and i want to print the array in single line but space between elements here it is printing new line

coderanger
  • 52,400
  • 4
  • 52
  • 75
Udhay
  • 7
  • 7
  • Can you edit your answer and paste the output of this code snippet? – Mark Mar 02 '17 at 23:57
  • /opt/mapr/server/configure.sh -N <%=@clust_name %> -c -C -Z <%=@zkall.join(":<%=@zk_p %> ") %> – Udhay Mar 03 '17 at 00:28
  • i am running this but some syntax error `/opt/mapr/server/configure.sh -N <%=@clust_name %> -c -C -Z <%=@zkall.join(":<%=@zk_p %> ") %>` – Udhay Mar 03 '17 at 00:28
  • Chef::Mixin::Template::TemplateError ((erubis):6: syntax error, unexpected '>' (erubis):11: unterminated string meets end of file) on line #: – Udhay Mar 03 '17 at 00:30
  • Please use the `chef` tag in the future so we can find your question. – coderanger Mar 03 '17 at 02:17

1 Answers1

0

Just put the whole thing on one line:

/opt/mapr/server/configure.sh -N <%=@clust_name %>  -c -C cldb  -Z <% @zookeeprall.each do |node| -%><%= node %>:<%=@zk_p %> <% end %> 

You could also use a Ruby expression like:

/opt/mapr/server/configure.sh -N <%=@clust_name %>  -c -C cldb  -Z <%= @zookeeprall.map {|node| "#{node}:#{@zk_p}" }.join(' ') %> 
coderanger
  • 52,400
  • 4
  • 52
  • 75