From 4b129313e88cec4dc1942bd13e936737e528b340 Mon Sep 17 00:00:00 2001 From: Chris Schrier <schrierc@google.com> Date: Fri, 20 Apr 2012 12:22:25 -0400 Subject: [PATCH] Change CertificateError to subclass GanetiApiError Signed-off-by: Chris Schrier <schrierc@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- lib/rapi/client.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/rapi/client.py b/lib/rapi/client.py index d68bb621d..15e61f4a8 100644 --- a/lib/rapi/client.py +++ b/lib/rapi/client.py @@ -133,13 +133,6 @@ class Error(Exception): pass -class CertificateError(Error): - """Raised when a problem is found with the SSL certificate. - - """ - pass - - class GanetiApiError(Error): """Generic error raised from Ganeti API. @@ -149,6 +142,13 @@ class GanetiApiError(Error): self.code = code +class CertificateError(GanetiApiError): + """Raised when a problem is found with the SSL certificate. + + """ + pass + + def _AppendIf(container, condition, value): """Appends to a list if a condition evaluates to truth. @@ -470,7 +470,8 @@ class GanetiRapiClient(object): # pylint: disable=R0904 curl.perform() except pycurl.error, err: 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]) finally: -- GitLab