diff --git a/lib/rapi/client.py b/lib/rapi/client.py index d68bb621def63b34c47cf0d1b4fde3e2f252c700..15e61f4a896ae57eeb52620515187ae983d97a56 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: