summaryrefslogtreecommitdiff
path: root/glanceclient/common
diff options
context:
space:
mode:
authorAbhishek Kekane <abhishek.kekane@nttdata.com>2016-07-18 11:55:22 +0530
committerAbhishek Kekane <abhishek.kekane@nttdata.com>2016-07-18 12:19:55 +0530
commit155183a21e106a7a1616c19f3a3249044c78d27e (patch)
tree6be067d8a786417b905567a8bf9777662c35bf79 /glanceclient/common
parent13093e019416894a4bd940d569bab4c3c0b84485 (diff)
downloadpython-glanceclient-155183a21e106a7a1616c19f3a3249044c78d27e.tar.gz
Log request-id before exceptions raised
As of now request-id is not logged if an excpetion is raised. Rearranged code so that request-id is logged even in case of an exception. Change-Id: Iee0398404ee752c0d880edf3054207c35862e71a Closes-Bug: #1603863
Diffstat (limited to 'glanceclient/common')
-rw-r--r--glanceclient/common/http.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/glanceclient/common/http.py b/glanceclient/common/http.py
index 0eb42de..39b9e9e 100644
--- a/glanceclient/common/http.py
+++ b/glanceclient/common/http.py
@@ -92,6 +92,16 @@ class _BaseHTTPClient(object):
return data
def _handle_response(self, resp):
+ # log request-id for each api cal
+ request_id = resp.headers.get('x-openstack-request-id')
+ if request_id:
+ LOG.debug('%(method)s call to glance-api for '
+ '%(url)s used request id '
+ '%(response_request_id)s',
+ {'method': resp.request.method,
+ 'url': resp.url,
+ 'response_request_id': request_id})
+
if not resp.ok:
LOG.debug("Request returned failure status %s." % resp.status_code)
raise exc.from_response(resp, resp.content)
@@ -120,16 +130,6 @@ class _BaseHTTPClient(object):
except ValueError:
body_iter = None
- # log request-id for each api call
- request_id = resp.headers.get('x-openstack-request-id')
- if request_id:
- LOG.debug('%(method)s call to glance-api for '
- '%(url)s used request id '
- '%(response_request_id)s',
- {'method': resp.request.method,
- 'url': resp.url,
- 'response_request_id': request_id})
-
return resp, body_iter