Class: Puppet::Pops::Lookup::ConfiguredDataProvider Private
- Includes:
- DataProvider
- Defined in:
- lib/puppet/pops/lookup/configured_data_provider.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.
Direct Known Subclasses
EnvironmentDataProvider, GlobalDataProvider, ModuleDataProvider
Instance Method Summary collapse
- #config(lookup_invocation) ⇒ Object private
-
#config_path ⇒ Pathname
private
The path to the configuration.
-
#initialize(config = nil) ⇒ ConfiguredDataProvider
constructor
private
A new instance of ConfiguredDataProvider.
-
#name ⇒ String
private
The name of this provider.
-
#unchecked_key_lookup(key, lookup_invocation, merge) ⇒ Object
private
Performs a lookup by searching all configured locations for the given key.
Methods included from DataProvider
ensure_types_initialized, #key_lookup, key_type, #lookup, #module_name, #validate_data_hash, #validate_data_value, value_type
Constructor Details
#initialize(config = nil) ⇒ ConfiguredDataProvider
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.
Returns a new instance of ConfiguredDataProvider.
11 12 13 |
# File 'lib/puppet/pops/lookup/configured_data_provider.rb', line 11 def initialize(config = nil) @config = config.nil? ? nil : assert_config_version(config) end |
Instance Method Details
#config(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.
15 16 17 |
# File 'lib/puppet/pops/lookup/configured_data_provider.rb', line 15 def config(lookup_invocation) @config ||= assert_config_version(HieraConfig.create(lookup_invocation, configuration_path(lookup_invocation))) end |
#config_path ⇒ Pathname
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.
Returns the path to the configuration.
20 21 22 |
# File 'lib/puppet/pops/lookup/configured_data_provider.rb', line 20 def config_path @config.nil? ? nil : @config.config_path end |
#name ⇒ String
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.
Returns the name of this provider.
25 26 27 28 29 30 31 |
# File 'lib/puppet/pops/lookup/configured_data_provider.rb', line 25 def name n = "#{place} " n << '"' << module_name << '" ' unless module_name.nil? n << 'Data Provider' n << " (#{@config.name})" unless @config.nil? n end |
#unchecked_key_lookup(key, lookup_invocation, merge) ⇒ 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.
Performs a lookup by searching all configured locations for the given key. A merge will be performed if the value is found in more than one location.
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/puppet/pops/lookup/configured_data_provider.rb', line 41 def unchecked_key_lookup(key, lookup_invocation, merge) lookup_invocation.with(:data_provider, self) do merge_strategy = MergeStrategy.strategy(merge) dps = data_providers(lookup_invocation) if dps.empty? lookup_invocation.report_not_found(key) throw :no_such_key end merge_strategy.lookup(data_providers(lookup_invocation), lookup_invocation) do |data_provider| data_provider.unchecked_key_lookup(key, lookup_invocation, merge_strategy) end end end |