On Thursday, July 25, 2013 9:27:26 AM UTC-5, chengkai liang wrote:
>
> So something doesn't look right for me when running puppet apply -e
> 'include ...' for looking heria via facter fact.
>
> I have hiera configure as this,
>
> :backends:
> - yaml
>
> :hierarchy:
> - common
> - '%{env_name}'
>
> :yaml:
> :datadir: /var/lib/hiera/data
>
> and, a file envXX.yaml store in the datadir, and I can run *hiera xyz
> env_name=envXX* to get the the value of abc associate with xyz.
>
> Yet, if I export the value variable env_name by *export
> FACTER_env_name=*envXX,
> and run:
>
> *puppet apply -e 'include my_module
>
> *
> puppet will complaint that it can't find data store in envXX.yaml.
That is a mischaracterization. Puppet does not say anything of the sort --
it's only your interpretation.
> From the debug output,
>
> debug: importing
> '/Users/cliang/.puppet/modules/puppet_flux2_config/manifests/init.pp' in
> environment production
> debug: Automatically imported puppet_flux2_config from puppet_flux2_config
> into production
> debug: hiera(): Hiera YAML backend starting
> debug: hiera(): Looking up host_header_url in YAML backend
> debug: hiera(): Looking for data source common
> Could not find data item host_header_url in any Hiera data file and no
> default supplied at
> /Users/cliang/.puppet/modules/puppet_flux2_config/manifests/init.pp:4 on
> node m-mba.local
>
> It seems that it stop looking right after common, while running with *hiera
> xyz env_name=envXX* *--debug *shows,
>
> DEBUG: Thu Jul 25 07:24:48 -0700 2013: Hiera YAML backend starting
> DEBUG: Thu Jul 25 07:24:48 -0700 2013: Looking up host_header_url in YAML
> backend
> DEBUG: Thu Jul 25 07:24:48 -0700 2013: Looking for data source common
> DEBUG: Thu Jul 25 07:24:48 -0700 2013: Looking for data source *envXX*
> DEBUG: Thu Jul 25 07:24:48 -0700 2013: Found xyz in *envXX*
>
> So why puppet apply won't look further into envXX.yaml file? Anybody can
> help on this?
>
>
Very likely, Puppet does not receive the env_name fact from Facter, causing
hiera to look for a file named '.yaml' instead of 'envXX.yaml' That would
not surprise me much, as it is in no way safe to assume that Puppet will
provide the same environment it receives to other components and programs
(such as Facter). That is not an issue when you query hiera directly,
because you give the correct value of env_name.
John
--
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.
For more options, visit https://groups.google.com/groups/opt_out.