diff --git a/app/models/manageiq/providers/kubernetes/monitoring_manager.rb b/app/models/manageiq/providers/kubernetes/monitoring_manager.rb index 13e93db054..da87015701 100644 --- a/app/models/manageiq/providers/kubernetes/monitoring_manager.rb +++ b/app/models/manageiq/providers/kubernetes/monitoring_manager.rb @@ -38,7 +38,9 @@ def self.event_monitor_class end def self.verify_credentials(options) - raw_connect(options)&.get&.key?('generationID') + response = raw_connect(options)&.get + response = JSON.parse(response) if response.kind_of?(String) + response.key?('generationID') if response rescue OpenSSL::X509::CertificateError => err raise MiqException::MiqInvalidCredentialsError, "SSL Error: #{err.message}" rescue Faraday::ParsingError @@ -60,7 +62,9 @@ def prometheus_alerts_endpoint def verify_credentials(_auth_type = nil, _options = {}) with_provider_connection do |conn| - conn.get.key?('generationID') + response = conn.get + response = JSON.parse(response) if response.kind_of?(String) + response.key?('generationID') end rescue OpenSSL::X509::CertificateError => err raise MiqException::MiqInvalidCredentialsError, "SSL Error: #{err.message}" diff --git a/app/models/manageiq/providers/kubernetes/monitoring_manager/event_catcher/stream.rb b/app/models/manageiq/providers/kubernetes/monitoring_manager/event_catcher/stream.rb index bc1572412b..cbaf48fde7 100644 --- a/app/models/manageiq/providers/kubernetes/monitoring_manager/event_catcher/stream.rb +++ b/app/models/manageiq/providers/kubernetes/monitoring_manager/event_catcher/stream.rb @@ -42,6 +42,7 @@ def fetch # } alert_list = @ems.connect.get(:generation_id => @current_generation, :from_index => @current_index) alerts = [] + alert_list = JSON.parse(alert_list) if alert_list.kind_of?(String) @current_generation = alert_list["generationID"] return alerts if alert_list['messages'].blank? alert_list["messages"].each do |message|