0

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.

rastasheep
  • 10,416
  • 3
  • 27
  • 37
gaurav
  • 421
  • 1
  • 6
  • 16

1 Answers1

2
<% 
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.

Stephen Carman
  • 999
  • 7
  • 25