Sha256: ae24c7a01fd5395d56a1a20763aa038977b28c09677699175fb7fa4ebfcc939f
Contents?: true
Size: 1.07 KB
Versions: 51
Compression:
Stored size: 1.07 KB
Contents
# frozen_string_literal: true module ProxyAPI # ProxyAPI for Ansible class Ansible < ::ProxyAPI::Resource def initialize(args) @url = args[:url] + '/ansible/' super args end PROXY_ERRORS = [ Errno::ECONNREFUSED, SocketError, Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError, RestClient::ResourceNotFound ].freeze def roles parse(get('roles')) rescue *PROXY_ERRORS => e raise ProxyException.new(url, e, N_('Unable to get roles from Ansible')) end def all_variables parse(get('roles/variables')) rescue *PROXY_ERRORS => e raise ProxyException.new(url, e, N_('Unable to get roles/variables from Ansible')) end def variables(role) parse(get("roles/#{role}/variables")) rescue *PROXY_ERRORS => e raise ProxyException.new(url, e, N_('Unable to get roles/variables from Ansible')) end end end
Version data entries
51 entries across 51 versions & 1 rubygems