Skip to content

Instantly share code, notes, and snippets.

@igalic
Created April 25, 2018 18:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igalic/02c682b1a5123c458a7c6ab538e6a29b to your computer and use it in GitHub Desktop.
Save igalic/02c682b1a5123c458a7c6ab538e6a29b to your computer and use it in GitHub Desktop.
# replace hiera-file with a custom lookeup_key backend
function profiles::file::hiera_backend(
String $key,
Hash $options,
Puppet::LookupContext $context,
) {
$contents = inline_template("<%= File.read('${options[path]}/${key}', mode: 'rb') {|f| f.read } if File.exists?('${options[path]}/${key}') %>")
if $contents == '' or $contents == undef {
$context.not_found
}
$contents
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment