Class: Puppet::DataProviders::JsonDataProvider Private

Inherits:
Plugins::DataProviders::PathBasedDataProvider show all
Defined in:
lib/puppet/data_providers/json_data_provider_factory.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary

Attributes inherited from Plugins::DataProviders::PathBasedDataProvider

#name

Instance Method Summary collapse

Methods inherited from Plugins::DataProviders::PathBasedDataProvider

#initialize, #load_data, #unchecked_lookup, #validate_data

Methods included from Plugins::DataProviders::DataProvider

#data_key, #lookup, #name, #post_process, #unchecked_lookup, #validate_data

Methods included from Pops::Lookup::Interpolation

#interpolate

Methods included from Pops::Lookup::SubLookup

#split_key, #sub_lookup

Constructor Details

This class inherits a constructor from Puppet::Plugins::DataProviders::PathBasedDataProvider

Instance Method Details

#initialize_data(path, lookup_invocation) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



19
20
21
22
23
24
# File 'lib/puppet/data_providers/json_data_provider_factory.rb', line 19

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