Actually I figured it out. The problem was that if I want to use directory 
the last element in the hierarchy must not be derived from a fact, so this 
works:

:hierarchy:
   - 
"%{::domain}/%{::environment}/%{::osfamily}/%{::lsbdistcodename}/params"

   /etc/puppet/data/loc.example.com/production/Debian/wheezy/params.yaml

where this does not (it works with puppet apply, but not with puppet agent):

:hierarchy:
   - "%{::domain}/%{::environment}/%{::osfamily}/%{::lsbdistcodename}"

   /etc/puppet/data/loc.example.com/production/Debian/wheezy.yaml

So not sure if this is by design or a bug, but I was not able to find this 
in any of the documentation, so putting it here if someone else encounters 
it.

On Monday, January 6, 2014 1:20:04 PM UTC-6, kai wrote:
>
> I have the following hiera.yaml file:
>
> ---
> :backends:
>   - yaml
>   - file
>
> :hierarchy:
>   - defaults
>   - "%{clientcert}"
>  * - "%{::domain}/%{::environment}/%{::osfamily}/%{::lsbdistcodename}"*
>   - global
>
> :yaml:
>   :datadir: /etc/puppet/data
>
> and the following in /etc/puppet/data:
>
> *loc.example.com/production/Debian/wheezy.yaml 
> <http://loc.example.com/production/Debian/wheezy.yaml>*
>
> The domain fact returns loc.example.com, the osfamily fact returns Debian 
> and the lsbdistcodename returns wheezy.
>
>
> When I run 
>
> puppet apply --environment=production -e '$test = 
> hiera('ssh_service_config') notify { $test: }'
>
> I get the ssh_service_config variable from the  /etc/puppet/data/
> loc.example.com/production/Debian/wheezy.yaml file, which in my mind 
> means that the correct file was chosen based on the 3 facts (environment. 
> osfamily and lsbdistcodename), which is what I want.
>
> However if I run:
>
> $ puppet agent -tv --environment=production
> Info: Retrieving plugin
> Error: Could not retrieve catalog from remote server: Error 400 on SERVER: 
> Could not find data item ssh_package_name in any Hiera data file and no 
> default supplied at 
> /srv/puppet/environments/production/modules/ssh/manifests/install.pp:2 on 
> node puppetmaster.iad3.example.com
> Warning: Not using cache on failed catalog
> Error: Could not retrieve catalog; skipping run
>
> Or:
>
> $ hiera -d ssh_service_config environment=production osfamily=Debian 
> lsbdistcodename=wheezy
> DEBUG: 2014-01-06 19:18:08 +0000: Hiera YAML backend starting
> DEBUG: 2014-01-06 19:18:08 +0000: Looking up ssh_service_config in YAML 
> backend
> DEBUG: 2014-01-06 19:18:08 +0000: Looking for data source defaults
> DEBUG: 2014-01-06 19:18:08 +0000: Looking for data source global
> DEBUG: 2014-01-06 19:18:08 +0000: Hiera File backend starting
> DEBUG: 2014-01-06 19:18:08 +0000: Looking up ssh_service_config in File 
> backend
> DEBUG: 2014-01-06 19:18:08 +0000: Hiera File_backend: looking for data 
> source 'defaults'
> DEBUG: 2014-01-06 19:18:08 +0000: Cannot find datafile 
> /var/lib/hiera/defaults.d, skipping
> DEBUG: 2014-01-06 19:18:08 +0000: Hiera File_backend: looking for data 
> source 'global'
> DEBUG: 2014-01-06 19:18:08 +0000: Cannot find datafile 
> /var/lib/hiera/global.d, skipping
> nil
>
> Any idea what is going on? I would like to have a simple hierarchy like 
> the one in the hiera.yaml file, based on the three facts.
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/9fcf5ea1-5328-4acc-9067-84fbed9982c3%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to