summaryrefslogtreecommitdiffstats
path: root/ipaserver/plugins/dogtag.py
diff options
context:
space:
mode:
authorFraser Tweedale <ftweedal@redhat.com>2016-08-26 09:04:04 +1000
committerMartin Babinsky <mbabinsk@redhat.com>2016-09-07 12:49:28 +0200
commitc5cbc8de89c7d88c443bff937fe9aa965e4c1c94 (patch)
tree1e8e55affe60ce79db51d79551f448715cc97a7f /ipaserver/plugins/dogtag.py
parent2a42a7e90eb8154a6722ae93d93f8cf6796f4a21 (diff)
downloadfreeipa-c5cbc8de89c7d88c443bff937fe9aa965e4c1c94.tar.gz
freeipa-c5cbc8de89c7d88c443bff937fe9aa965e4c1c94.tar.xz
freeipa-c5cbc8de89c7d88c443bff937fe9aa965e4c1c94.zip
Add HTTPRequestError class
Currently, HTTP requests that respond with status not in the 2xx range raise RemoteRetrieveError. The exception includes no information about the response status. Add the 'HTTPRequestError' class which extends 'RemoteRequestError' with an attribute for the response status, and update the Dogtag RestClient to raise the new error. Part of: https://fedorahosted.org/freeipa/ticket/6260 Part of: https://fedorahosted.org/freeipa/ticket/3473 Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
Diffstat (limited to 'ipaserver/plugins/dogtag.py')
-rw-r--r--ipaserver/plugins/dogtag.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/ipaserver/plugins/dogtag.py b/ipaserver/plugins/dogtag.py
index f3fb2703f..a7742ffa9 100644
--- a/ipaserver/plugins/dogtag.py
+++ b/ipaserver/plugins/dogtag.py
@@ -2113,7 +2113,8 @@ class RestClient(Backend):
)
if status < 200 or status >= 300:
explanation = self._parse_dogtag_error(resp_body) or ''
- raise errors.RemoteRetrieveError(
+ raise errors.HTTPRequestError(
+ status=status,
reason=_('Non-2xx response from CA REST API: %(status)d. %(explanation)s')
% {'status': status, 'explanation': explanation}
)