Class: Jerakia::Response
- Defined in:
- lib/jerakia/response/filter/strsub.rb,
lib/jerakia/response.rb,
lib/jerakia/response/filter.rb,
lib/jerakia/response/filter/dig.rb,
lib/jerakia/response/filter/encryption.rb
Overview
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
Defined Under Namespace
Modules: Filter Classes: Entry
Constant Summary
Constants inherited from Jerakia
Instance Attribute Summary collapse
-
#lookup ⇒ Object
readonly
Returns the value of attribute lookup.
Attributes inherited from Jerakia
Instance Method Summary collapse
- #entries ⇒ Object
-
#initialize(lookup) ⇒ Response
constructor
A new instance of Response.
- #no_more_answers ⇒ Object
- #parse_values ⇒ Object
- #responses ⇒ Object
- #submit(val) ⇒ Object
- #want? ⇒ Boolean
Methods inherited from Jerakia
Constructor Details
Instance Attribute Details
#lookup ⇒ Object (readonly)
Returns the value of attribute lookup.
2 3 4 |
# File 'lib/jerakia/response.rb', line 2 def lookup @lookup end |
Instance Method Details
#entries ⇒ Object
60 61 62 |
# File 'lib/jerakia/response.rb', line 60 def entries @entries.select { |e| e.valid? } end |
#no_more_answers ⇒ Object
73 74 75 |
# 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 ⇒ Object
64 65 66 67 68 69 70 71 |
# 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 ⇒ Object
54 55 56 57 58 |
# File 'lib/jerakia/response.rb', line 54 def responses @entries.each do |entry| yield entry end end |
#submit(val) ⇒ Object
44 45 46 47 48 49 50 51 52 |
# 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? ⇒ Boolean
35 36 37 38 39 40 41 |
# File 'lib/jerakia/response.rb', line 35 def want? if lookup.request.lookup_type == :first && !entries.empty? return false else return true end end |