Reputation: 431
I have a attribute in the form of array, and i want to iterate over it in Chef template ?
<% node['db2']['instance_username'].each do |device| -%>
<%= "/home/#{device}/sqllib/lib64" %>
<% end -%>
I'm doing like this but it is giving error.
Upvotes: 0
Views: 3746
Reputation: 997
<%
node['db2']['instance_username'].each do |device|
%>
/home/<%= device %>/sqllib/lib64
<% end %>
I'd rewrite it like this instead. If you are having an error try taking out the end hyphens out they are a rails construct and I'm not sure if they cross over well but it would help a lot if you posted the error you are having. Most likely instance username is not an array.
Upvotes: 2