Sha256: 2be8eda327f5e5bc01e2653d322fba70c271b98dc83007192c435a78221fc28e
Contents?: true
Size: 865 Bytes
Versions: 12
Compression:
Stored size: 865 Bytes
Contents
# This file is loaded by the autoloader, and it does not find the data function support unless required relative # require 'json' module Puppet::DataProviders # @api private class JsonDataProviderFactory < Puppet::Plugins::DataProviders::FileBasedDataProviderFactory def create(name, paths, parent_data_provider) JsonDataProvider.new(name, paths, parent_data_provider) end def path_extension '.json' end end # @api private class JsonDataProvider < Puppet::Plugins::DataProviders::PathBasedDataProvider def initialize_data(path, lookup_invocation) JSON.parse(Puppet::FileSystem.read(path, :encoding => 'utf-8')) 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
Version data entries
12 entries across 12 versions & 1 rubygems