Sha256: 077705198bbf38a4bcec0ebbb1d975716afa7b96e166c68521de98bac3d229cc
Contents?: true
Size: 558 Bytes
Versions: 4
Compression:
Stored size: 558 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 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 end
Version data entries
4 entries across 4 versions & 1 rubygems