cleanup openstack-common.conf and sync updated files
Changes include: e782594 Add last_request_id only if it is not none 18bf5ca Fix usage of NotFound exception in apiclient.base 3bc8231 deprecate apiclient package Depends-On: Ia83ef6136da1c551ea947679dc546a0d7ad2f876 Change-Id: I0b5917c657d6adc3d34229b14833a5224c168e07
This commit is contained in:
parent
39020950d6
commit
a5f30d173f
@ -57,6 +57,10 @@ class Manager(base.HookableMixin):
|
||||
def __init__(self, api):
|
||||
self.api = api
|
||||
|
||||
@property
|
||||
def client(self):
|
||||
return self.api.client
|
||||
|
||||
def _list(self, url, response_key, obj_class=None, body=None):
|
||||
if body:
|
||||
_resp, body = self.api.client.post(url, body=body)
|
||||
|
@ -221,6 +221,7 @@ class HTTPClient(object):
|
||||
|
||||
self.service_catalog = None
|
||||
self.services_url = {}
|
||||
self.last_request_id = None
|
||||
|
||||
def use_token_cache(self, use_it):
|
||||
self.os_cache = use_it
|
||||
@ -392,6 +393,8 @@ class HTTPClient(object):
|
||||
else:
|
||||
body = None
|
||||
|
||||
self.last_request_id = (resp.headers.get('x-openstack-request-id')
|
||||
if resp.headers else None)
|
||||
if resp.status_code >= 400:
|
||||
raise exceptions.from_response(resp, body, url, method)
|
||||
|
||||
|
@ -20,6 +20,20 @@
|
||||
Base utilities to build API operation managers and objects on top of.
|
||||
"""
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# THIS MODULE IS DEPRECATED
|
||||
#
|
||||
# Please refer to
|
||||
# https://etherpad.openstack.org/p/kilo-novaclient-library-proposals for
|
||||
# the discussion leading to this deprecation.
|
||||
#
|
||||
# We recommend checking out the python-openstacksdk project
|
||||
# (https://launchpad.net/python-openstacksdk) instead.
|
||||
#
|
||||
########################################################################
|
||||
|
||||
|
||||
# E1102: %s is not callable
|
||||
# pylint: disable=E1102
|
||||
|
||||
@ -388,7 +402,7 @@ class CrudManager(BaseManager):
|
||||
'name': self.resource_class.__name__,
|
||||
'args': kwargs
|
||||
}
|
||||
raise exceptions.NotFound(404, msg)
|
||||
raise exceptions.NotFound(msg)
|
||||
elif num > 1:
|
||||
raise exceptions.NoUniqueMatch
|
||||
else:
|
||||
@ -495,6 +509,9 @@ class Resource(object):
|
||||
new = self.manager.get(self.id)
|
||||
if new:
|
||||
self._add_details(new._info)
|
||||
if self.manager.client.last_request_id:
|
||||
self._add_details(
|
||||
{'x_request_id': self.manager.client.last_request_id})
|
||||
|
||||
def __eq__(self, other):
|
||||
if not isinstance(other, Resource):
|
||||
|
@ -181,8 +181,7 @@ class FakeHTTPClient(client.HTTPClient):
|
||||
else:
|
||||
status, body = resp
|
||||
headers = {}
|
||||
self.last_request_id = headers.get('x-openstack-request-id',
|
||||
'req-test')
|
||||
self.last_request_id = headers.get('x-openstack-request-id')
|
||||
return TestResponse({
|
||||
"status_code": status,
|
||||
"text": body,
|
||||
|
@ -56,6 +56,7 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
self.bypass_url = 'bypass_url'
|
||||
self.os_cache = 'os_cache'
|
||||
self.http_log_debug = 'http_log_debug'
|
||||
self.last_request_id = None
|
||||
|
||||
def _cs_request(self, url, method, **kwargs):
|
||||
# Check that certain things are called correctly
|
||||
|
@ -3,7 +3,6 @@
|
||||
# The list of modules to copy from oslo-incubator
|
||||
module=apiclient
|
||||
module=cliutils
|
||||
module=install_venv_common
|
||||
|
||||
# The base module to hold the copy of openstack.common
|
||||
base=novaclient
|
||||
|
Loading…
Reference in New Issue
Block a user