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| -%>
*
* code*
*<% end %>*
*<% scope.function_hiera('allowed_ips').each do |comment, ip| -%>
*
* code <%= ip %> code # <%= comment %>*
*<% end %>*
And finally calling them in the node:
*node example.com {*
* class {"iptables":*
* role => ["role1", "role 2"]*
* }*
*}*
The above configuration gives the following error:
> Error 400 on SERVER: Failed to parse template iptables/test.erb: can't
> convert Array into String at .../iptables/manifests/init.pp:3 on node
> example.com
The weird part is that taken individually (either using only the role array
or only the hiera hash) they work perfectly. But when I combine them in the
same template I get the above error. And it doesn't have to
be necessarily a hiera hash or inside a template. Any hiera data called
from a class with an array p*arameter. *
Am I doing something wrong? It might be a bug but I want to first make sure
that I am using this the right way.
--
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/-/AKM_WbSvMAsJ.
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.