Sha256: ee7f5c02a8e8c9e4165bbfd3e1902de4bbc2357e9263d53f030a20e2b55f3051
Contents?: true
Size: 690 Bytes
Versions: 16
Compression:
Stored size: 690 Bytes
Contents
# @since 4.9.0 # Puppet::Functions.create_function(:hocon_data) do unless Puppet.features.hocon? raise Puppet::DataBinding::LookupError, 'Lookup using Hocon data_hash function is not supported without hocon library' end require 'hocon' require 'hocon/config_error' dispatch :hocon_data do param 'Struct[{path=>String[1]}]', :options param 'Puppet::LookupContext', :context end def hocon_data(options, context) path = options['path'] begin Hocon.parse(Puppet::FileSystem.read(path, :encoding => 'utf-8')) rescue Hocon::ConfigError => ex raise Puppet::DataBinding::LookupError, "Unable to parse (#{path}): #{ex.message}" end end end
Version data entries
16 entries across 16 versions & 1 rubygems