Last active
January 13, 2023 12:48
-
-
Save hlindberg/11a683c504172de7f2e3d455323d0d1f 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
Puppet::Functions.create_function(:env_data) do | |
# @since 4.8.0 | |
dispatch :env_data do | |
param 'Struct[{}]', :options | |
param 'Puppet::LookupContext', :context | |
end | |
def env_data(options, context) | |
ENV.to_h | |
end | |
end |
The function is now updated to not accept any options. Earlier it required a "path".
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This naive (and untested) implementation of a hiera 5 backend makes it possible to look up environment variables in puppet.
This backed is a
data_hash
type of backend and it is configured without "path" or "uri" inhiera.yaml
. This means that function will be called once during the life of one hiera instance (one compilation). This means we do not have to worry about performance.