Re: [Puppet Users] Hiera data unusable in a class with an array parameter

2012-02-09 Thread Vlad
That fixes it! Thanks. In all my debugging I assumed that " can't convert Array into String " referred to the hiera variables. And it was about the role variable all along. You were right, I had a top scope variable role defined in a custom fact, which was also in the hiera hierarchy, and anoth

Re: [Puppet Users] Hiera data unusable in a class with an array parameter

2012-02-09 Thread Nan Liu
On Thu, Feb 9, 2012 at 9:09 PM, Vlad wrote: > Thanks Gary and Lelutin. > > Gary: That was the first thing I tried, and no luck there either. I even > took out the template out of the equation and called a simple variable like: > common.yaml: >> >> --- >> test: testvar > > >> >> class test ($role)

Re: [Puppet Users] Hiera data unusable in a class with an array parameter

2012-02-09 Thread Vlad
Thanks Gary and Lelutin. Gary: That was the first thing I tried, and no luck there either. I even took out the template out of the equation and called a simple variable like: common.yaml: > *--- > **test: testvar* > *class test ($role) {* *$ips = hiera('test') > **notify {"${ips}:}* }

Re: [Puppet Users] Hiera data unusable in a class with an array parameter

2012-02-09 Thread Gabriel Filion
try adding this in your template above the call to scope.function_hiera_array(): <% Puppet::Parser::Functions.function('hiera_array') -%> On 12-02-09 11:47 PM, Vlad wrote: > Thanks Nan, I've tried them all (hiera, hiera_array and hiera_hash), > unfortunately with no luck. > Like I mentioned above

Re: [Puppet Users] Hiera data unusable in a class with an array parameter

2012-02-09 Thread Gary Larizza
Vlad, Have you tried setting the variable inside your Puppet manifest before you call it in the template? Something like: $ips = hiera_hash('allowed_ips') file {/tmp/test: content => template(iptables/test.erb) } And then in the template: *<% ips.each do |comment, ip| -%> * * code <%= i

Re: [Puppet Users] Hiera data unusable in a class with an array parameter

2012-02-09 Thread Vlad
Thanks Nan, I've tried them all (hiera, hiera_array and hiera_hash), unfortunately with no luck. Like I mentioned above, it doesn't have to be necessarily a hiera hash. Even a simple var: name inside the yaml file gives that error. As long as you have an array defined as a parameter, together wi

Re: [Puppet Users] Hiera data unusable in a class with an array parameter

2012-02-09 Thread Nan Liu
What you want is the hiera_array instead of hiera function. There's also a hiera_hash function. Thanks Nan On Feb 9, 2012, at 19:49, Vlad wrote: Given the following hiera hash: common.yaml: --- *allowed_ips:* * "First IP": 1.2.3.4* * "Second IP": 5.6.7.8* and the module: *class iptables ($r

[Puppet Users] Hiera data unusable in a class with an array parameter

2012-02-09 Thread Vlad
Given the following hiera hash: common.yaml: --- *allowed_ips:* * "First IP": 1.2.3.4* * "Second IP": 5.6.7.8* and the module: *class iptables ($role) {* * file {/tmp/test:* *content => template(iptables/test.erb)* * }* *}* with the corresponding template test.erb: *<% role.each do |role|