Class: Puppet::Pops::Lookup::V3BackendFunctionProvider

Inherits:
LookupKeyFunctionProvider show all
Defined in:
lib/puppet/pops/lookup/lookup_key_function_provider.rb

Constant Summary collapse

TAG =
'hiera3_backend'.freeze

Instance Attribute Summary

Attributes inherited from FunctionProvider

#function_name, #locations, #parent_data_provider

Instance Method Summary collapse

Methods inherited from LookupKeyFunctionProvider

#invoke_with_location, #label, #unchecked_key_lookup

Methods inherited from FunctionProvider

#create_function_context, #function_context, #initialize, #module_name, #name, #options, #to_s

Methods included from DataProvider

ensure_types_initialized, #key_lookup, key_type, #lookup, #module_name, #name, #unchecked_key_lookup, #validate_data_hash, #validate_data_value, value_type

Constructor Details

This class inherits a constructor from Puppet::Pops::Lookup::FunctionProvider

Instance Method Details

#lookup_key(key, lookup_invocation, location, merge) ⇒ Object



90
91
92
93
94
95
96
97
98
# File 'lib/puppet/pops/lookup/lookup_key_function_provider.rb', line 90

def lookup_key(key, lookup_invocation, location, merge)
  @backend ||= instantiate_backend(lookup_invocation)
  config = parent_data_provider.config(lookup_invocation)

  # A merge_behavior retrieved from hiera.yaml must not be converted here. Instead, passing the symbol :hash
  # tells the V3 backend to pick it up from the config.
  resolution_type = lookup_invocation.hiera_v3_merge_behavior? ? :hash : convert_merge(merge)
  @backend.lookup(key, lookup_invocation.scope, lookup_invocation.hiera_v3_location_overrides, resolution_type, context = {:recurse_guard => nil})
end