Sha256: f206eb85668f6065aed2d1b6f9a38ee294a8bcf9a2276e67c30d1d225cc7fb4a
Contents?: true
Size: 1.46 KB
Versions: 31
Compression:
Stored size: 1.46 KB
Contents
require 'rest-client' module ForemanRhCloud class CloudPingService class CertPing include ForemanRhCloud::CloudRequest include InsightsCloud::CandlepinCache attr_accessor :logger def initialize(org, logger) @org = org @logger = logger end def ping certs = candlepin_id_cert(@org) return StandardError.new('certificate missing') unless certs cert_checker = Katello::UpstreamConnectionChecker.new(@org) cert_checker.assert_connection execute_cloud_request( method: :get, url: ForemanRhCloud.cert_base_url + "/api/apicast-tests/ping", headers: { content_type: :json, }, ssl_client_cert: OpenSSL::X509::Certificate.new(certs[:cert]), ssl_client_key: OpenSSL::PKey.read(certs[:key]) ) rescue StandardError => ex ex end end def initialize(organizations, logger) @organizations = organizations @logger = logger end def ping { cert_auth: Hash[ @organizations.map do |org| cert_response = CertPing.new(org, @logger).ping [ org, { success: cert_response.is_a?(RestClient::Response), error: (cert_response.is_a?(Exception) ? cert_response&.message || cert_response.inspect : nil), }, ] end ], } end end end
Version data entries
31 entries across 31 versions & 1 rubygems