Skip to content

Commit

Permalink
Merge pull request #10199 from jelkosz/fix-error-handling-in-rhev-pro…
Browse files Browse the repository at this point in the history
…vider

Fix wrong error handling in rhevm infrastructure provider
(cherry picked from commit f899b03)

https://bugzilla.redhat.com/show_bug.cgi?id=1374696
  • Loading branch information
blomquisg authored and chessbyte committed Sep 9, 2016
1 parent 7259a93 commit 7871b4b
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions app/models/manageiq/providers/redhat/infra_manager.rb
Expand Up @@ -117,13 +117,17 @@ def with_provider_connection(options = {})
end

def verify_credentials_for_rhevm(options = {})
connect(options).api
rescue URI::InvalidURIError
raise "Invalid URI specified for RHEV server."
rescue SocketError => err
raise "Error occurred attempted to connect to RHEV server.", err
rescue => err
raise MiqException::MiqEVMLoginError, err
with_provider_connection(options, &:api)
rescue SocketError, Errno::EHOSTUNREACH, Errno::ENETUNREACH
_log.warn($ERROR_INFO)
raise MiqException::MiqUnreachableError, $ERROR_INFO
rescue Ovirt::MissingResourceError, URI::InvalidURIError
raise MiqException::MiqUnreachableError, "Invalid URI specified for the server."
rescue RestClient::Unauthorized
raise MiqException::MiqInvalidCredentialsError, "Incorrect user name or password."
rescue
_log.error("Error while verifying credentials #{$ERROR_INFO}")
raise MiqException::MiqEVMLoginError, $ERROR_INFO
end

def rhevm_metrics_connect_options(options = {})
Expand Down

1 comment on commit 7871b4b

@jelkosz
Copy link
Contributor

@jelkosz jelkosz commented on 7871b4b Sep 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chessbyte LGTM

Please sign in to comment.