Class: Puppet::DataBinding::Jerakia_rest

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Jerakia_rest

Returns a new instance of Jerakia_rest.



19
20
21
22
23
24
# File 'lib/puppet/indirector/data_binding/jerakia_rest.rb', line 19

def initialize(*args)
  @jerakia=::Jerakia.new
  @jerakia_url=@jerakia.config.server_url
  @policy = "puppet"
  super
end

Instance Attribute Details

#jerakiaObject (readonly)

Returns the value of attribute jerakia.



15
16
17
# File 'lib/puppet/indirector/data_binding/jerakia_rest.rb', line 15

def jerakia
  @jerakia
end

#jerakia_urlObject (readonly)

Returns the value of attribute jerakia_url.



16
17
18
# File 'lib/puppet/indirector/data_binding/jerakia_rest.rb', line 16

def jerakia_url
  @jerakia_url
end

#policyObject (readonly)

Returns the value of attribute policy.



17
18
19
# File 'lib/puppet/indirector/data_binding/jerakia_rest.rb', line 17

def policy
  @policy
end

Instance Method Details

#find(request) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/puppet/indirector/data_binding/jerakia_rest.rb', line 26

def find(request)

  lookupdata=request.key.split(/::/)
  key=lookupdata.pop
  namespace=lookupdata

  #metadata =  request.options[:variables].to_hash
 
   = {
    :environment => request.options[:variables].environment,
  }
  payload={
    :namespace => namespace,
    :lookup_type => :first,
    :metadata => ,
  }.to_json
  response = RestClient.get "#{jerakia_url}/#{policy}/#{key}", :params => { :payload => payload }
  response
end