Sha256: 319322c6addea8244e19556ca4811c81401f7e2cfd822d03046e0747a2c3b99e
Contents?: true
Size: 846 Bytes
Versions: 8
Compression:
Stored size: 846 Bytes
Contents
# @since 4.8.0 # Puppet::Functions.create_function(:json_data) do dispatch :json_data do param 'Struct[{path=>String[1]}]', :options param 'Puppet::LookupContext', :context end argument_mismatch :missing_path do param 'Hash', :options param 'Puppet::LookupContext', :context end def json_data(options, context) path = options['path'] context.cached_file_data(path) do |content| begin JSON.parse(content) rescue JSON::ParserError => ex # Filename not included in message, so we add it here. raise Puppet::DataBinding::LookupError, "Unable to parse (#{path}): #{ex.message}" end end end def missing_path(options, context) "one of 'path', 'paths' 'glob', 'globs' or 'mapped_paths' must be declared in hiera.yaml when using this data_hash function" end end
Version data entries
8 entries across 8 versions & 1 rubygems