Class: Puppet::DataProviders::YamlDataProvider Deprecated Private

Inherits:
Plugins::DataProviders::PathBasedDataProvider show all
Defined in:
lib/puppet/data_providers/yaml_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

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.



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

def initialize_data(path, lookup_invocation)
  unless Puppet[:strict] == :off
    Puppet.warn_once(:deprecation, 'Puppet::DataProviders::YamlDataProvider',
    'Puppet::DataProviders::YamlDataProvider is deprecated and will be removed in the next major version of Puppet')
  end
  data = YAML.load_file(path)
  HieraConfig.symkeys_to_string(data.nil? ? {} : data)
rescue YAML::SyntaxError => ex
  # Psych errors includes the absolute path to the file, so no need to add that
  # to the message
  raise Puppet::DataBinding::LookupError, "Unable to parse #{ex.message}"
end