Class: Puppet::DataBinding::Jerakia

Inherits:
Indirector::Code
  • Object
show all
Defined in:
lib/puppet/indirector/data_binding/jerakia.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#jerakiaObject (readonly)

Returns the value of attribute jerakia.



8
9
10
# File 'lib/puppet/indirector/data_binding/jerakia.rb', line 8

def jerakia
  @jerakia
end

#policyObject (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.options[: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