Module: Puppet::Plugins::DataProviders::DataProvider Private
- Includes:
- Puppet::Pops::Lookup::Interpolation
- Included in:
- EnvironmentDataProvider, ModuleDataProvider, PathBasedDataProvider
- Defined in:
- lib/puppet/plugins/data_providers/data_provider.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
-
#data_key(key, lookup_invocation) ⇒ String?
private
Obtain an optional key to use when retrieving the data.
-
#lookup(name, lookup_invocation, merge) ⇒ Object
private
Performs a lookup with an endless recursion check.
- #name ⇒ Object private
-
#post_process(value, lookup_invocation) ⇒ Object
private
Perform optional post processing of found value.
-
#unchecked_lookup(key, lookup_invocation, merge) ⇒ Object
private
Performs a lookup with the assumption that a recursive check has been made.
- #validate_data(data, data_key) ⇒ Object private
Methods included from Puppet::Pops::Lookup::Interpolation
Methods included from Puppet::Pops::Lookup::SubLookup
Instance Method Details
#data_key(key, lookup_invocation) ⇒ 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.
Obtain an optional key to use when retrieving the data.
70 71 72 |
# File 'lib/puppet/plugins/data_providers/data_provider.rb', line 70 def data_key(key, lookup_invocation) nil end |
#lookup(name, 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 with an endless recursion check.
13 14 15 |
# File 'lib/puppet/plugins/data_providers/data_provider.rb', line 13 def lookup(name, lookup_invocation, merge) lookup_invocation.check(name) { unchecked_lookup(name, lookup_invocation, merge) } end |
#name ⇒ 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.
84 85 86 87 |
# File 'lib/puppet/plugins/data_providers/data_provider.rb', line 84 def name cname = self.class.name cname[cname.rindex(':')+1..-1] end |
#post_process(value, 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.
Perform optional post processing of found value. The default implementation resolves interpolation expressions
44 45 46 |
# File 'lib/puppet/plugins/data_providers/data_provider.rb', line 44 def post_process(value, lookup_invocation) interpolate(value, lookup_invocation, true) end |
#unchecked_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 with the assumption that a recursive check has been made.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/puppet/plugins/data_providers/data_provider.rb', line 22 def unchecked_lookup(key, lookup_invocation, merge) segments = split_key(key) root_key = segments.shift lookup_invocation.with(:data_provider, self) do hash = data(data_key(root_key, lookup_invocation), lookup_invocation) value = hash[root_key] if value || hash.include?(root_key) value = sub_lookup(key, lookup_invocation, segments, value) unless segments.empty? lookup_invocation.report_found(key, post_process(value, lookup_invocation)) else lookup_invocation.report_not_found(key) throw :no_such_key end end end |
#validate_data(data, data_key) ⇒ 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.
89 90 91 |
# File 'lib/puppet/plugins/data_providers/data_provider.rb', line 89 def validate_data(data, data_key) data end |