Class: EasyType::PuppetService
- Inherits:
-
Object
- Object
- EasyType::PuppetService
show all
- Defined in:
- lib/easy_type/puppet_service.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of PuppetService.
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/easy_type/puppet_service.rb', line 7
def initialize
if Puppet[:tasks]
hostname = Facter.value('fqdn')
@server = hostname
@host_cert = "/etc/puppetlabs/puppet/ssl/certs/#{hostname}.pem"
@ca_cert = "/etc/puppetlabs/puppet/ssl/certs/ca.pem"
@key = "/etc/puppetlabs/puppet/ssl/private_keys/#{hostname}.pem"
else
@server = ENV['PUPPET_SERVER'] || Puppet.settings['server']
@host_cert = ENV['PUPPET_HOSTCERT'] || Puppet.settings['hostcert']
@ca_cert = ENV['PUPPET_LOCALCERT'] || Puppet.settings['localcacert']
@key = ENV['PUPPET_HOSTPRIVKEY'] ||Puppet.settings['hostprivkey']
end
end
|
Instance Method Details
#get(endpoint, query = nil) ⇒ Object
22
23
24
|
# File 'lib/easy_type/puppet_service.rb', line 22
def get(endpoint, query = nil)
JSON.parse(https_call('get', endpoint, query).body)
end
|
#post(endpoint, data) ⇒ Object
26
27
28
|
# File 'lib/easy_type/puppet_service.rb', line 26
def post(endpoint, data)
JSON.parse(https_call('post', endpoint, nil, data).body)
end
|