Class: Hiera::Backend::Backend1xWrapper
- Inherits:
-
Object
- Object
- Hiera::Backend::Backend1xWrapper
- Defined in:
- lib/hiera/backend.rb
Instance Method Summary collapse
-
#initialize(wrapped) ⇒ Backend1xWrapper
constructor
A new instance of Backend1xWrapper.
- #lookup(key, scope, order_override, resolution_type, context) ⇒ Object
Constructor Details
#initialize(wrapped) ⇒ Backend1xWrapper
Returns a new instance of Backend1xWrapper.
12 13 14 |
# File 'lib/hiera/backend.rb', line 12 def initialize(wrapped) @wrapped = wrapped end |
Instance Method Details
#lookup(key, scope, order_override, resolution_type, context) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# 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 |