The ruby call you're looking for is each_pair used like this:

<% scope.lookupvar('hash').each_pair do |key,value| -%>
<%= key %> = <%= value %>
<% end -%>



On Sunday, March 15, 2015 at 9:16:08 PM UTC+11, Luca Gervasi wrote:
>
> Hello,
>
> i'm trying to achieve aconfiguration where i can applt a  non 
> predetermined list of hashes. Specifically, i'm willing to add to php.ini 
> (or fpm...) specific flags.
>
> This is my hiera data:
>
> fpm::pools::web::adminvalues:
>  - error_log: /var/log/fpm/$pool/php.log
>  - memory_limit: 32M
> fpm::pools::web::adminflags:
>  - display_errors: off
>  - log_errors: on
>
> fpm::pools::web::adminvalues and fpm::pools::web::adminflags's hashes is 
> variable, so I have 2 entries in this example, but i should be able to 
> iterate and apply whichever settings is configured. (this means that i 
> cannot refer to them like $adminvalues['error_log']).
>
> This is a snippet of the ruby code I used to extract the codes (which is 
> ineffective):
>
> [this is a local manifest variable, $name is "web" (so the hiera lookup is 
> not the problem here)]
> $pooladminflags = hiera_array("fpm::pools::${name}::adminflags", "")
> $pooladminvals = hiera_array("fpm::pools::${name}::adminvalues", "")
>
> [this is in the template i use]
> <%
> scope.lookupvar('pooladminflags').each do |key| -%>
> php_admin_flag[<%=key[0]%>] = <%=key[1]%>
> <% end-%>
>
> Needless to say, it is empty. What am I missing?
>
> Thanks a lot.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/74295ad9-49c1-40cb-9d3a-29907e0976d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to