Hi

I have the hiera_yamlgpg backend up and running working like a charm with 
the following configuration:
:yamlgpg:
:datadir: "/etc/puppet/environments/%{::environment}/hieradata"
:key_dir: "/etc/puppet/keys" # optional, defaults to ~/.gnupg
:fail_on_error: true # optional, defaults to false 

By business requirements I have been asked to use one or another private 
key depending a custom fact. So my hiera.yaml configuration file looks like 
this:
:yamlgpg:
:datadir: "/etc/puppet/environments/%{::environment}/hieradata"
:key_dir: "/etc/puppet/keys/%{::custom_fact}" # optional, defaults to 
~/.gnupg
:fail_on_error: true # optional, defaults to false 

The problem I am facing is that hiera is not interpolating the 
%{::custom_fact} on the :key_dir: line. The error I get is:

WARN: Tue Apr 07 15:41:17 +0200 2015: No usable keys found in 
/etc/puppet/keys/%{::custom_fact}/. Check :key_dir value in hiera.yaml is 
correct
/etc/puppet/environments/production/modules/hiera_yamlgpg/lib/hiera/backend/yamlgpg_backend.rb:102:in
 
`decrypt_ciphertext': No usable keys found in 
/etc/puppet/keys/%{::custom_fact}/. Check :key_dir value in hiera.yaml is 
correct (Hiera::Backend::YamlgpgError) 

Puppetlabs' documentation [1] says " You can also interpolate variables 
into other settings, such as :datadir (in the YAML and JSON backends):" 
which makes sense with the behavior I am getting (Sadly, it doesn't says 
anything about other variables :():
  * The %{::environment} variable on :datadir: line is interpolated
  * But %{::custom_fact} on :key_dir: is not.

Any Idea how to workaround this? 

[1] http://docs.puppetlabs.com/hiera/1/variables.html#in-other-settings

Thank you for your time

Best regards

--------------------------------------------------------------------------------------
Juan Sierra Pons                                 j...@elsotanillo.net
Linux User Registered: #257202      
Web: http://www.elsotanillo.net Git: http://www.github.com/juasiepo
GPG key = 0xA110F4FE
Key Fingerprint = DF53 7415 0936 244E 9B00  6E66 E934 3406 A110 F4FE
--------------------------------------------------------------------------------------


-- 
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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/2f05482d-1452-4f05-aeee-d524d05d7e9a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to