dogtag.py: fix exception logging of JSON data

'read_ca' and 'create_ca' have no logging when exception happened and it
masks real reason why it failed.

Reviewed-By: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
Martin Basti 2017-01-11 14:38:25 +01:00
parent 1e0f98a146
commit 0eb5a0e0ec

View File

@ -2116,16 +2116,20 @@ class ra_lightweight_ca(RestClient):
)
try:
return json.loads(resp_body)
except:
raise errors.RemoteRetrieveError(reason=_("Response from CA was not valid JSON"))
except Exception as e:
self.log.debug(e, exc_info=True)
raise errors.RemoteRetrieveError(
reason=_("Response from CA was not valid JSON"))
def read_ca(self, ca_id):
_status, _resp_headers, resp_body = self._ssldo(
'GET', ca_id, headers={'Accept': 'application/json'})
try:
return json.loads(resp_body)
except:
raise errors.RemoteRetrieveError(reason=_("Response from CA was not valid JSON"))
except Exception as e:
self.log.debug(e, exc_info=True)
raise errors.RemoteRetrieveError(
reason=_("Response from CA was not valid JSON"))
def read_ca_cert(self, ca_id):
_status, _resp_headers, resp_body = self._ssldo(