How to Run for each loop in template chef
问题 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. 回答1: <% 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