Skip to content

Commit

Permalink
JSON parse prometheus_alert client responses
Browse files Browse the repository at this point in the history
  • Loading branch information
agrare committed Oct 3, 2024
1 parent a8437b4 commit 9075268
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def self.event_monitor_class
end

def self.verify_credentials(options)
raw_connect(options)&.get&.key?('generationID')
response = raw_connect(options)&.get
JSON.parse(response).key?('generationID') if response
rescue OpenSSL::X509::CertificateError => err
raise MiqException::MiqInvalidCredentialsError, "SSL Error: #{err.message}"
rescue Faraday::ParsingError
Expand All @@ -60,7 +61,8 @@ def prometheus_alerts_endpoint

def verify_credentials(_auth_type = nil, _options = {})
with_provider_connection do |conn|
conn.get.key?('generationID')
response = JSON.parse(conn.get)
response.key?('generationID')
end
rescue OpenSSL::X509::CertificateError => err
raise MiqException::MiqInvalidCredentialsError, "SSL Error: #{err.message}"
Expand Down

0 comments on commit 9075268

Please sign in to comment.