Class: ProxyAPI::Ansible

Inherits:
Resource
  • Object
show all
Defined in:
app/lib/proxy_api/ansible.rb

Overview

ProxyAPI for Ansible

Constant Summary collapse

PROXY_ERRORS =
[
  Errno::ECONNREFUSED,
  SocketError,
  Timeout::Error,
  Errno::EINVAL,
  Errno::ECONNRESET,
  EOFError,
  Net::HTTPBadResponse,
  Net::HTTPHeaderSyntaxError,
  Net::ProtocolError,
  RestClient::ResourceNotFound
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Ansible

Returns a new instance of Ansible.



4
5
6
7
# File 'app/lib/proxy_api/ansible.rb', line 4

def initialize(args)
  @url = args[:url] + '/ansible/'
  super args
end

Instance Method Details

#rolesObject



22
23
24
25
26
# File 'app/lib/proxy_api/ansible.rb', line 22

def roles
  parse(get('roles'))
rescue *PROXY_ERRORS => e
  raise ProxyException.new(url, e, N_('Unable to get roles from Ansible'))
end