Skip to content

Commit

Permalink
Catch SSLError too when adding a provider
Browse files Browse the repository at this point in the history
Expands ManageIQ#314.
KubeException already covers the common "certificate verify failed" SSL
errors but not rarer ones like "does not match the server certificate".
This might be resolved in Kubeclient or RestClient one day
(ManageIQ/kubeclient#240) but it's blocked
on backward compatibility concerns so let's catch it here for now.

get_hostname_from_routes is best-effort, should never crash UI.
Any SSL error will probably fail both get_hostname_from_routes and the
main validation code; the error from validation will then be displayed
in a red flash.
https://bugzilla.redhat.com/show_bug.cgi?id=1436221
  • Loading branch information
cben committed Apr 9, 2017
1 parent 528236d commit 7e2bc52
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/mixins/ems_common_angular.rb
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ def get_hostname_from_routes(ems, endpoint_hash, token)
client = ems.class.raw_connect(endpoint.hostname, endpoint.port,
:service => :openshift, :bearer => token, :ssl_options => ssl_options)
client.get_route('hawkular-metrics', 'openshift-infra').try(:spec).try(:host)
rescue KubeException => e
rescue KubeException, OpenSSL::SSL::SSLError => e
$log.warn("MIQ(#{controller_name}_controller-#{action_name}): get_hostname_from_routes error: #{e}")
nil
end
Expand Down

0 comments on commit 7e2bc52

Please sign in to comment.