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=(config) ⇒ Object deprecated private Deprecated.
-
#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
#key_lookup, #key_lookup_in_default, key_type, #lookup, #module_name, register_types, #validate_data_hash, #validate_data_value, #value_is_validated?, 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.
13 14 15 |
# File 'lib/puppet/pops/lookup/configured_data_provider.rb', line 13 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.
17 18 19 |
# File 'lib/puppet/pops/lookup/configured_data_provider.rb', line 17 def config(lookup_invocation) @config ||= assert_config_version(HieraConfig.create(lookup_invocation, configuration_path(lookup_invocation), self)) end |
#config=(config) ⇒ 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.
Needed to assign generated version 4 config
23 24 25 |
# File 'lib/puppet/pops/lookup/configured_data_provider.rb', line 23 def config=(config) @config = config 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.
28 29 30 |
# File 'lib/puppet/pops/lookup/configured_data_provider.rb', line 28 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.
33 34 35 36 37 38 39 |
# File 'lib/puppet/pops/lookup/configured_data_provider.rb', line 33 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.
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/puppet/pops/lookup/configured_data_provider.rb', line 49 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(dps, lookup_invocation) do |data_provider| data_provider.unchecked_key_lookup(key, lookup_invocation, merge_strategy) end end end |