Merge "x-openstack-request-id logged twice in logs"

This commit is contained in:
Jenkins 2017-02-06 09:08:22 +00:00 committed by Gerrit Code Review
commit 30fdde8e4e
2 changed files with 11 additions and 7 deletions
neutronclient

@ -110,6 +110,17 @@ class HTTPClient(object):
_logger.debug("throwing ConnectionFailed : %s", e)
raise exceptions.ConnectionFailed(reason=e)
utils.http_log_resp(_logger, resp, body)
# log request-id for each api call
request_id = resp.headers.get('x-openstack-request-id')
if request_id:
_logger.debug('%(method)s call to neutron for '
'%(url)s used request id '
'%(response_request_id)s',
{'method': resp.request.method,
'url': resp.url,
'response_request_id': request_id})
if resp.status_code == 401:
raise exceptions.Unauthorized(message=body)
return resp, body

@ -119,13 +119,6 @@ class _RequestIdMixin(object):
# Extract 'x-openstack-request-id' from headers if
# response is a Response object.
request_id = resp.headers.get('x-openstack-request-id')
# log request-id for each api call
_logger.debug('%(method)s call to neutron for '
'%(url)s used request id '
'%(response_request_id)s',
{'method': resp.request.method,
'url': resp.url,
'response_request_id': request_id})
else:
# If resp is of type string.
request_id = resp