I'm sure I'm doing something silly here, but I'm struggling to pass an 
array variable to a parameterized class and have it stay as an array:

# cat modules/testmodule/manifests/init.pp
class testmodule($array1) {
    file {'/tmp/testmodule' :
        content => template('testmodule/testmodule.erb'),
    }
}

# cat manifests/nodes/site.pp
node 'testclient' {
    $myarray = ['aaa','bbb']
    class { "testmodule":
        array1 => [$myarray],
    }
}

# cat modules/testmodule/templates/testmodule.erb
<% array1.each do |val| -%>
array1 val: <%= val %>
<% end -%>

<puppet run>

# cat /tmp/testmodule
array1 val: aaabbb

i.e. the class does not think $array1 is an array any more.  However if I 
change the node config to set the parameter as an array explicitly:

# cat manifests/nodes/site.pp
node 'testclient' {
    class { "testmodule":
        array1 => ['aaa','bbb'],
    }
}

<puppet run>

# cat /tmp/testmodule
array1 val: aaa
array1 val: bbb

Its not unreasonable to try and pass an array as a variable is it?

Cheers,

Tom.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/TjLIZvQPSd8J.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to