Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encryptor option defaults do not work when using Hiera. #286

Open
crayfishx opened this issue Nov 7, 2019 · 0 comments
Open

Encryptor option defaults do not work when using Hiera. #286

crayfishx opened this issue Nov 7, 2019 · 0 comments

Comments

@crayfishx
Copy link
Contributor

Using Puppet 6.8.1 with hiera-yaml 3.0.0.

When using an encryptor plugin that has options with defaults, things work fine when using eyaml from the command line, any options that are not defined in on the CLI or in .eyaml/config.yaml will continue to have their defaults. Eg: with the vault plugin;

[1] pry(Hiera::Backend::Eyaml::Encryptors::Vault)> options
=> {:addr=>{:desc=>"Address of the vault server", :type=>:string, :default=>"https://127.0.0.1:8200"},
 :role_id=>{:desc=>"role_id for the Approle", :type=>:string},
 :secret_id=>{:desc=>"secret_id for the Approle", :type=>:string},
 :use_ssl=>{:desc=>"Use SSL to connect to vault", :type=>:boolean, :default=>true},
 :ssl_verify=>{:desc=>"Verify SSL certs", :type=>:boolean, :default=>true},
 :keyname=>{:desc=>"Vault transit key name (default 'hiera')", :type=>:string, :default=>"hiera"},
 :api_version=>{:desc=>"API version to use", :type=>:integer, :default=>1}}
[2] pry(Hiera::Backend::Eyaml::Encryptors::Vault)> option :use_ssl
=> true

However, when using Puppet/Hiera, it seems to only see the options specifically configured in the hiera.yaml options: hash and any non defined configuration options get dropped and the defaults are not used.... the above test when using Hiera (and use_ssl being absent from the options hash) gives me;

[2] pry(Hiera::Backend::Eyaml::Encryptors::Vault)> option :use_ssl
=> nil

This means that I have to specify all options for an encryptor plugin in hiera.yaml as the defaults will not work.

Im not sure if this is an issue with eyaml or with the Puppet function that integrates with it, I suspect it could be something to do with;

https://github.com/puppetlabs/puppet/blob/master/lib/puppet/functions/eyaml_lookup_key.rb#L87

But Im hitting roadblocks trying to test this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant