Loading...

puppet-users@googlegroups.com

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: [Puppet Users] Some advice on using hashes in ERB templates needed Michael DeHaan Fri Apr 30 07:00:52 2010

>
> Now I want to iterate over the 'workers' inside the ERB template and tried 
> (among others) this:
>
>     16 <% workers.each do |worker| -%>
>     17 <%= @m_worker = Marshal.load(worker) %>
>     18 worker.<%= worker %>.type=<%= @m_worker.type %>
>     ...
>     25
>     26 <% end -%>
>
> Accessing the 'workers' hash works, but accessing 'worker.type' and 
> 'worker.host' not. I guess I will have to learn Ruby now ;-) but in the 
> meantime, can some Ruby expert please tell me how to do this? Thanks a lot in 
> advance!
>
> Bernd
>

worker['type'] and worker['host'] is the way the Ruby should look.

--Michael

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [EMAIL PROTECTED]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.