class Jerakia::Response

strsub is in output filter that matches tags in data and replaces them for values in the scope. It mimics the hiera features of being able to embed %{::var} in YAML documents. This output filter may not provide 100% compatibility to hiera but it should cover most scenarios.

Jerakia does not support method or literal interpolations, just straightforward %{var} and %{::var}

::var will be lookuped up as scope

Attributes

lookup[R]

Public Class Methods

new(lookup) click to toggle source
# File lib/jerakia/response.rb, line 28
def initialize(lookup)
  @entries = []
  @lookup = lookup
  require 'jerakia/response/filter'
  extend Jerakia::Response::Filter
end

Public Instance Methods

entries() click to toggle source
# File lib/jerakia/response.rb, line 60
def entries
  @entries.select { |e| e.valid? }
end
no_more_answers() click to toggle source
# File lib/jerakia/response.rb, line 73
def no_more_answers
  Jerakia.log.debug 'warning: backend tried to submit too many answers'
end
parse_values() { |v| ... } click to toggle source
# File lib/jerakia/response.rb, line 64
def parse_values
  @entries.map! do |entry|
    Jerakia::Util.walk(entry.value) do |v|
      yield v
    end
    entry
  end
end
responses() { |entry| ... } click to toggle source
# File lib/jerakia/response.rb, line 54
def responses
  @entries.each do |entry|
    yield entry
  end
end
submit(val) click to toggle source
# File lib/jerakia/response.rb, line 44
def submit(val)
  Jerakia.log.debug "Backend submitted #{val}"
  if want?
    @entries << Jerakia::Response::Entry.new(val)
    Jerakia.log.debug "Added answer #{val}"
  else
    no_more_answers
  end
end
want?() click to toggle source
# File lib/jerakia/response.rb, line 35
def want?
  if lookup.request.lookup_type == :first && !entries.empty?
    return false
  else
    return true
  end
end