Class: Puppet::Pops::Lookup::V3DataHashFunctionProvider Private

Inherits:
DataHashFunctionProvider show all
Defined in:
lib/puppet/pops/lookup/data_hash_function_provider.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.

API:

  • private

Constant Summary collapse

TAG =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

API:

  • private

'v3_data_hash'

Constants included from SubLookup

SubLookup::SPECIAL

Instance Attribute Summary

Attributes inherited from FunctionProvider

#function_name, #locations, #parent_data_provider

Instance Method Summary collapse

Methods inherited from DataHashFunctionProvider

trusted_return_type

Methods included from Interpolation

#interpolate

Methods included from SubLookup

#split_key, #sub_lookup

Methods inherited from FunctionProvider

#create_function_context, #full_name, #function_context, #module_name, #name, #options, #to_s, trusted_return_type, #value_is_validated?

Methods included from DataProvider

#key_lookup, #key_lookup_in_default, key_type, #lookup, #module_name, #name, register_types, #validate_data_hash, #validate_data_value, #value_is_validated?, value_type

Constructor Details

#initialize(name, parent_data_provider, function_name, options, locations) ⇒ V3DataHashFunctionProvider

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 V3DataHashFunctionProvider.

API:

  • private



87
88
89
90
# File 'lib/puppet/pops/lookup/data_hash_function_provider.rb', line 87

def initialize(name, parent_data_provider, function_name, options, locations)
  @datadir = options.delete(HieraConfig::KEY_DATADIR)
  super
end

Instance Method Details

#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.

API:

  • private



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/puppet/pops/lookup/data_hash_function_provider.rb', line 92

def unchecked_key_lookup(key, lookup_invocation, merge)
  extra_paths = lookup_invocation.hiera_v3_location_overrides
  if extra_paths.nil? || extra_paths.empty?
    super
  else
    # Extra paths provided. Must be resolved and placed in front of known paths
    paths = parent_data_provider.config(lookup_invocation).resolve_paths(@datadir, extra_paths, lookup_invocation, false, ".#{@name}")
    all_locations = paths + locations
    root_key = key.root_key
    lookup_invocation.with(:data_provider, self) do
      MergeStrategy.strategy(merge).lookup(all_locations, lookup_invocation) do |location|
        invoke_with_location(lookup_invocation, location, root_key)
      end
    end
  end
end