diff --git a/keystoneclient/client.py b/keystoneclient/client.py index 11e64085b..d862136bd 100644 --- a/keystoneclient/client.py +++ b/keystoneclient/client.py @@ -127,6 +127,13 @@ class HTTPClient(httplib2.Http): **request_kwargs) self.http_log_resp(resp, body) + if resp.status in (400, 401, 403, 404, 408, 409, 413, 500, 501): + _logger.debug("Request returned failure status.") + raise exceptions.from_response(resp, body) + elif resp.status in (301, 302, 305): + # Redirected. Reissue the request to the new location. + return self.request(resp['location'], method, **kwargs) + if body: try: body = json.loads(body) @@ -136,13 +143,6 @@ class HTTPClient(httplib2.Http): _logger.debug("No body was returned.") body = None - if resp.status in (400, 401, 403, 404, 408, 409, 413, 500, 501): - _logger.exception("Request returned failure status.") - raise exceptions.from_response(resp, body) - elif resp.status in (301, 302, 305): - # Redirected. Reissue the request to the new location. - return self.request(resp['location'], method, **kwargs) - return resp, body def _cs_request(self, url, method, **kwargs): diff --git a/keystoneclient/v2_0/client.py b/keystoneclient/v2_0/client.py index 130887235..fef1178ed 100644 --- a/keystoneclient/v2_0/client.py +++ b/keystoneclient/v2_0/client.py @@ -106,9 +106,9 @@ class Client(client.HTTPClient): self._extract_service_catalog(self.auth_url, raw_token) return True except (exceptions.AuthorizationFailure, exceptions.Unauthorized): + _logger.debug("Authorization Failed.") raise except Exception, e: - _logger.exception("Authorization Failed.") raise exceptions.AuthorizationFailure("Authorization Failed: " "%s" % e)