class Hiera::Backend::Backend1xWrapper

Public Class Methods

new(wrapped) click to toggle source
# File lib/hiera/backend.rb, line 12
def initialize(wrapped)
  @wrapped = wrapped
end

Public Instance Methods

lookup(key, scope, order_override, resolution_type, context) click to toggle source
# File lib/hiera/backend.rb, line 16
def lookup(key, scope, order_override, resolution_type, context)
  Hiera.debug("Using Hiera 1.x backend API to access instance of class #{@wrapped.class.name}. Lookup recursion will not be detected")
  value = @wrapped.lookup(key, scope, order_override, resolution_type.is_a?(Hash) ? :hash : resolution_type)

  # The most likely cause when an old backend returns nil is that the key was not found. In any case, it is
  # impossible to know the difference between that and a found nil. The throw here preserves the old behavior.
  throw (:no_such_key) if value.nil?
  value
end