Class: Puppet::DataProviders::JsonDataProvider Deprecated Private

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

Overview

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.

Deprecated.

TODO: API 5.0, remove this class

API:

  • private

Constant Summary

Constants included from Pops::Lookup::SubLookup

Pops::Lookup::SubLookup::SPECIAL

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, #key_lookup, #lookup, #name, #post_process, #unchecked_key_lookup, #unchecked_lookup, #validate_data

Methods included from Pops::Lookup::Interpolation

#interpolate

Methods included from Pops::Lookup::SubLookup

#split_key, #sub_lookup

Methods included from Pops::Lookup::DataProvider

#key_lookup, #key_lookup_in_default, key_type, #lookup, #module_name, #name, register_types, #unchecked_key_lookup, #validate_data_hash, #validate_data_value, #value_is_validated?, value_type

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.

API:

  • private



27
28
29
30
31
32
33
34
35
36
# File 'lib/puppet/data_providers/json_data_provider_factory.rb', line 27

def initialize_data(path, lookup_invocation)
  unless Puppet[:strict] == :off
    Puppet.warn_once(:deprecation, 'Puppet::DataProviders::JsonDataProvider',
      'Puppet::DataProviders::JsonDataProvider is deprecated and will be removed in the next major version of Puppet')
  end
  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