I just got it working - and yeah, very similar.
I have to generate a given file several times so the loop is outside of the
template - but got it working.
On Tue, Oct 16, 2012 at 9:09 PM, Jesse Nelson firstname.lastname@example.org wrote:
You can pass any ruby data to your template via the variables option.
Erb templates support loops:
template “/tmp/foo” do
variables( :org => org )
<% @org.each do |org| -%>
org is: <%= org %>
<% end %>
This is untested code i just wrote in the email, but the concept
should be communicated.
On Tue, Oct 16, 2012 at 5:52 PM, Maven User <email@example.com>
> A better way would be - how can I user a property in a recipe to expand
> tokens inside an erb file - or is that not possible?
> On Tue, Oct 16, 2012 at 7:46 PM, Maven User <firstname.lastname@example.org>
>> Hi list -
>> I'm struggling a little bit with something - I'm trying to provision a
>> "demo" environment and we need to set up several "fake" users.
>> Part of this process is to fill in some data in a template then run a
>> script, but I feel like the loop just selects the last thing in the
>> orgs = ["Ermergerd", "FOO"]
>> orgs.each do |org|
>> Chef::Log.info("Org is : " + org)
>> node.set[:org] = org
>> Chef::Log.info("Org after node set: " + node[:org])
>> Is there a way to do this? I'm not even seeing anything come out of
>> loop :-/