I've found out that it works if inside the loop I define $item_name = itemand 
then reference it as 
$item_name in the template.


On Tuesday, February 5, 2013 10:04:14 PM UTC+2, Andriy Yurchuk wrote:
>
> hostclass :class do
>   items = scope.lookupvar('items_list')
>   items.each do |item|
>     file("/etc/init.d/#{item}",
>          :content => template(['class/item_init.erb']))
>   end
> end
>
> Having this class written in Ruby DSL, how do I properly reference the 
> item variable in the template? I tried <%= item %>, <%= @item %>,<%= 
> scope.lookupvar('item')%> but none of them work.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to