Created
April 25, 2018 18:27
-
-
Save igalic/02c682b1a5123c458a7c6ab538e6a29b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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