Hiera can't find puppet environment
- by quickshiftin
I'm testing out hiera and hitting a snag on the hierarchy configuration. What I have is extremely simple, the part that isn't working is specification of hiera datadir files based on environment. Here's the config file (/etc/hiera.yaml) I'm trying
---
:backends:
- yaml
:logger: console
:hierarchy:
- "%{::environment}"
:yaml:
:datadir: /var/lib/hiera
Now, I have a file /var/lib/hiera/development.yaml
blah: meh
When I run hiera it's not finding the file or the value
$ hiera -d blah
DEBUG: Fri Oct 25 15:50:52 -0600 2013: Hiera YAML backend starting
DEBUG: Fri Oct 25 15:50:52 -0600 2013: Looking up blah in YAML backend
nil
I've verified this agent is configured for development
$ sudo puppet agent --configprint environment
development
Now let me prove hiera is capable of finding something; a change to the hiera.yaml file:
:hierarchy:
- development
And now hiera finds the file and the value
$ hiera -d blah
DEBUG: Fri Oct 25 15:53:25 -0600 2013: Hiera YAML backend starting
DEBUG: Fri Oct 25 15:53:25 -0600 2013: Looking up blah in YAML backend
DEBUG: Fri Oct 25 15:53:25 -0600 2013: Looking for data source development
DEBUG: Fri Oct 25 15:53:25 -0600 2013: Found blah in development
meh
So why isn't it working with the dynamic environment configuration? I got that straight from the documentation. Note, I have tried running the hiera command via sudo with no change in the result.