http://docs.puppetlabs.com/hiera/1/hierarchy.html#location-and-syntax
Dynamic data source - It says I should use %{::variable} notation for the 
hierarchy in the hiera.yaml file.

RHEL 5, Puppet 3.1.1, Hiera 1.2.0

/etc/puppet/hiera.yaml : 
---
:backends:
  - yaml  
:yaml:
  :datadir: '/etc/puppet/hieradata'
:logger: console 
:hierarchy:
  - %{environment}/common
  - common

/etc/puppet/hieradata/common.yaml : 
---
#foo:  barr

/etc/puppet/hieradata/dev/common.yaml : 
---
foo:  boo


If I use the "::" top level scope, it does not work.

[root puppet]# hiera foo -d -c /etc/puppet/hiera.yaml environment=dev 
DEBUG: Mon Apr 15 12:52:51 -0400 2013: Hiera YAML backend starting
DEBUG: Mon Apr 15 12:52:51 -0400 2013: Looking up foo in YAML backend
DEBUG: Mon Apr 15 12:52:51 -0400 2013: Looking for data source common
nil

If I remove the double-colon, (and restart puppetmaster) it works.

[root puppet]# hiera foo -d -c /etc/puppet/hiera.yaml environment=dev 
DEBUG: Mon Apr 15 12:53:11 -0400 2013: Hiera YAML backend starting
DEBUG: Mon Apr 15 12:53:11 -0400 2013: Looking up foo in YAML backend
DEBUG: Mon Apr 15 12:53:11 -0400 2013: Looking for data source dev/common
DEBUG: Mon Apr 15 12:53:11 -0400 2013: Found foo in dev/common
boo

The debug output from the first try even shows that it is not looking for the 
environment.

What am I doing wrong, please ?

“Sometimes I think the surest sign that intelligent life exists elsewhere in 
the universe is that none of it has tried to contact us.”
Bill Waterson (Calvin & Hobbes)

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to