Class: Puppet::DataBinding::Jerakia
- Inherits:
-
Indirector::Code
- Object
- Indirector::Code
- Puppet::DataBinding::Jerakia
- Defined in:
- lib/puppet/indirector/data_binding/jerakia.rb
Instance Attribute Summary collapse
-
#jerakia ⇒ Object
readonly
Returns the value of attribute jerakia.
-
#policy ⇒ Object
readonly
Returns the value of attribute policy.
Instance Method Summary collapse
- #find(request) ⇒ Object
-
#initialize(*args) ⇒ Jerakia
constructor
A new instance of Jerakia.
Constructor Details
#initialize(*args) ⇒ Jerakia
Returns a new instance of Jerakia.
11 12 13 14 15 |
# File 'lib/puppet/indirector/data_binding/jerakia.rb', line 11 def initialize(*args) @jerakia = ::Jerakia.new @default_policy = 'default' super end |
Instance Attribute Details
#jerakia ⇒ Object (readonly)
Returns the value of attribute jerakia.
8 9 10 |
# File 'lib/puppet/indirector/data_binding/jerakia.rb', line 8 def jerakia @jerakia end |
#policy ⇒ Object (readonly)
Returns the value of attribute policy.
9 10 11 |
# File 'lib/puppet/indirector/data_binding/jerakia.rb', line 9 def policy @policy end |
Instance Method Details
#find(request) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/puppet/indirector/data_binding/jerakia.rb', line 17 def find(request) lookupdata = request.key.split(/::/) key = lookupdata.pop return {} if key == 'lookup_options' namespace = lookupdata = request.[:variables].to_hash.reject { |_k, v| v.is_a?(Puppet::Resource) } policy = ['jerakia_policy'] || @default_policy jacreq = Jerakia::Request.new( :key => key, :namespace => namespace, :policy => policy, :lookup_type => :first, :metadata => ) answer = jerakia.lookup(jacreq) answer.payload end |