Project

General

Profile

« Previous | Next » 

Revision a989a617

Added by Ohad Levy about 12 years ago

  • ID a989a6171e3130f50933e7d6694ab416c8f69cda

fixes #1509 - Foreman should use the proxy to import puppet classes

View differences:

lib/proxy_api.rb
# TODO: add error message handling
def parse response
if response and response.code >= 200 and response.code < 300
return response.body.size > 2 ? JSON.parse(response.body) : true
return response.body.present? ? JSON.parse(response.body) : true
else
false
end
......
end
end
class Puppet < Resource
def initialize args
@url = args[:url] + "/puppet"
super args
end
def environments
parse(get "environments")
end
def environment env
parse(get "environments/#{env}")
end
def classes env
return if env.blank?
parse(get "environments/#{env}/classes").map { |k| k.keys.first }
rescue RestClient::ResourceNotFound
[]
end
end
class Puppetca < Resource
def initialize args
@url = args[:url] + "/puppet/ca"
......
end
def autosign
result = parse(get "autosign")
result == true ? [] : result
parse(get "autosign")
end
def set_autosign certname

Also available in: Unified diff