Class: Puppet::DataProviders::YamlDataProvider

Inherits:
Plugins::DataProviders::PathBasedDataProvider show all
Includes:
HieraInterpolate
Defined in:
lib/puppet/data_providers/yaml_data_provider_factory.rb

Instance Attribute Summary

Attributes inherited from Plugins::DataProviders::PathBasedDataProvider

#name

Instance Method Summary collapse

Methods included from HieraInterpolate

#interpolate

Methods inherited from Plugins::DataProviders::PathBasedDataProvider

#initialize, #load_data, #unchecked_lookup, #validate_data

Methods included from Plugins::DataProviders::DataProvider

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

Constructor Details

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

Instance Method Details

#initialize_data(path, lookup_invocation) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/puppet/data_providers/yaml_data_provider_factory.rb', line 20

def initialize_data(path, lookup_invocation)
  HieraConfig.symkeys_to_string(YAML.load_file(path))
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

#post_process(value, lookup_invocation) ⇒ Object



28
29
30
# File 'lib/puppet/data_providers/yaml_data_provider_factory.rb', line 28

def post_process(value, lookup_invocation)
  interpolate(value, lookup_invocation, true)
end