Hi People,
I came across an issue where hiera command line tool returns a different data to what puppet3.0 builtin hiera does.
When I say different data, I mean hiera tool returns an array of items collected throughout the hierarchy, while hiera_array() called from within a manifest returns an array of items from the very top level of hierarchy.
Here is my setup example:
-----
node1.example.local.yaml:
foo::conf:
- 'node_specific = foo'
- 'node_specific2 = foo2'
common.yaml:
foo::conf:
- 'common = foo'
- 'common2 = foo2'
-----
That's what I get by running hiera tool on the puppet master:
# hiera -c /etc/puppet/hiera.yaml -a foo::conf environment='development' fqdn='node1.example.local'
["node_specific = foo", "node_specific2 = foo2", "common = foo", "common2 = foo2"]
From within the manifest, I use as a parameter:
$conf = hiera_array('foo::conf')
and then I have a template which creates a file on a node:
<% conf.each do |item| -%>
<%= item %>
<% end -%>
.. so what this template create is the following content of a file on node1:
node_specific = foo
node_specific2 = foo2
The node is in development environment.
What am I doing wrong? Is this some kind of bug or intentional behavior of puppet and hiera?
Thanks,
Vaidas