Issue #17896 has been updated by Andrew Parker.

Target version deleted (3.0.x)


----------------------------------------
Bug #17896: Hiera tool and hiera_array() returns different data
https://projects.puppetlabs.com/issues/17896#change-80557

Author: Vaidas Jablonskis
Status: Closed
Priority: High
Assignee: 
Category: 
Target version: 
Affected Puppet version: 3.0.1
Keywords: hiera, hiera_array, puppet
Branch: 


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:

YAML data files below:

    # cat nodes/node1.example.local.yaml:
    foo::conf:
    - 'node_specific = foo'
    - 'node_specific2 = foo2'

    # cat 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

My hiera.yaml looks like this:
    # cat /etc/puppet/hiera.yaml 
    ---
    :hierarchy:
    - %{environment}/nodes/%{fqdn}
    - %{environment}/roles/%{role}
    - %{environment}/common
    :backends:
    - yaml
    #- puppet
    :yaml:
    :datadir: '/etc/puppet/hieradata'
    :puppet:
    :datasource: 'data'
    
The node is in development environment.

To me it looks like a bug unless I am doing something fundamentally wrong?

Thanks,
Vaidas


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
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-bugs?hl=en.

Reply via email to