Skip to content
Snippets Groups Projects
Commit 4b129313 authored by Chris Schrier's avatar Chris Schrier Committed by Michael Hanselmann
Browse files

Change CertificateError to subclass GanetiApiError


Signed-off-by: default avatarChris Schrier <schrierc@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 971b3a98
No related branches found
No related tags found
No related merge requests found
...@@ -133,13 +133,6 @@ class Error(Exception): ...@@ -133,13 +133,6 @@ class Error(Exception):
pass pass
class CertificateError(Error):
"""Raised when a problem is found with the SSL certificate.
"""
pass
class GanetiApiError(Error): class GanetiApiError(Error):
"""Generic error raised from Ganeti API. """Generic error raised from Ganeti API.
...@@ -149,6 +142,13 @@ class GanetiApiError(Error): ...@@ -149,6 +142,13 @@ class GanetiApiError(Error):
self.code = code self.code = code
class CertificateError(GanetiApiError):
"""Raised when a problem is found with the SSL certificate.
"""
pass
def _AppendIf(container, condition, value): def _AppendIf(container, condition, value):
"""Appends to a list if a condition evaluates to truth. """Appends to a list if a condition evaluates to truth.
...@@ -470,7 +470,8 @@ class GanetiRapiClient(object): # pylint: disable=R0904 ...@@ -470,7 +470,8 @@ class GanetiRapiClient(object): # pylint: disable=R0904
curl.perform() curl.perform()
except pycurl.error, err: except pycurl.error, err:
if err.args[0] in _CURL_SSL_CERT_ERRORS: if err.args[0] in _CURL_SSL_CERT_ERRORS:
raise CertificateError("SSL certificate error %s" % err) raise CertificateError("SSL certificate error %s" % err,
code=err.args[0])
raise GanetiApiError(str(err), code=err.args[0]) raise GanetiApiError(str(err), code=err.args[0])
finally: finally:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment