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
novaclient
openstack-common.conf@ -57,6 +57,10 @@ class Manager(base.HookableMixin):
|
|||||||
def __init__(self, api):
|
def __init__(self, api):
|
||||||
self.api = api
|
self.api = api
|
||||||
|
|
||||||
|
@property
|
||||||
|
def client(self):
|
||||||
|
return self.api.client
|
||||||
|
|
||||||
def _list(self, url, response_key, obj_class=None, body=None):
|
def _list(self, url, response_key, obj_class=None, body=None):
|
||||||
if body:
|
if body:
|
||||||
_resp, body = self.api.client.post(url, body=body)
|
_resp, body = self.api.client.post(url, body=body)
|
||||||
|
@ -221,6 +221,7 @@ class HTTPClient(object):
|
|||||||
|
|
||||||
self.service_catalog = None
|
self.service_catalog = None
|
||||||
self.services_url = {}
|
self.services_url = {}
|
||||||
|
self.last_request_id = None
|
||||||
|
|
||||||
def use_token_cache(self, use_it):
|
def use_token_cache(self, use_it):
|
||||||
self.os_cache = use_it
|
self.os_cache = use_it
|
||||||
@ -392,6 +393,8 @@ class HTTPClient(object):
|
|||||||
else:
|
else:
|
||||||
body = None
|
body = None
|
||||||
|
|
||||||
|
self.last_request_id = (resp.headers.get('x-openstack-request-id')
|
||||||
|
if resp.headers else None)
|
||||||
if resp.status_code >= 400:
|
if resp.status_code >= 400:
|
||||||
raise exceptions.from_response(resp, body, url, method)
|
raise exceptions.from_response(resp, body, url, method)
|
||||||
|
|
||||||
|
@ -20,6 +20,20 @@
|
|||||||
Base utilities to build API operation managers and objects on top of.
|
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
|
# E1102: %s is not callable
|
||||||
# pylint: disable=E1102
|
# pylint: disable=E1102
|
||||||
|
|
||||||
@ -388,7 +402,7 @@ class CrudManager(BaseManager):
|
|||||||
'name': self.resource_class.__name__,
|
'name': self.resource_class.__name__,
|
||||||
'args': kwargs
|
'args': kwargs
|
||||||
}
|
}
|
||||||
raise exceptions.NotFound(404, msg)
|
raise exceptions.NotFound(msg)
|
||||||
elif num > 1:
|
elif num > 1:
|
||||||
raise exceptions.NoUniqueMatch
|
raise exceptions.NoUniqueMatch
|
||||||
else:
|
else:
|
||||||
@ -495,6 +509,9 @@ class Resource(object):
|
|||||||
new = self.manager.get(self.id)
|
new = self.manager.get(self.id)
|
||||||
if new:
|
if new:
|
||||||
self._add_details(new._info)
|
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):
|
def __eq__(self, other):
|
||||||
if not isinstance(other, Resource):
|
if not isinstance(other, Resource):
|
||||||
|
@ -181,8 +181,7 @@ class FakeHTTPClient(client.HTTPClient):
|
|||||||
else:
|
else:
|
||||||
status, body = resp
|
status, body = resp
|
||||||
headers = {}
|
headers = {}
|
||||||
self.last_request_id = headers.get('x-openstack-request-id',
|
self.last_request_id = headers.get('x-openstack-request-id')
|
||||||
'req-test')
|
|
||||||
return TestResponse({
|
return TestResponse({
|
||||||
"status_code": status,
|
"status_code": status,
|
||||||
"text": body,
|
"text": body,
|
||||||
|
@ -56,6 +56,7 @@ class FakeHTTPClient(base_client.HTTPClient):
|
|||||||
self.bypass_url = 'bypass_url'
|
self.bypass_url = 'bypass_url'
|
||||||
self.os_cache = 'os_cache'
|
self.os_cache = 'os_cache'
|
||||||
self.http_log_debug = 'http_log_debug'
|
self.http_log_debug = 'http_log_debug'
|
||||||
|
self.last_request_id = None
|
||||||
|
|
||||||
def _cs_request(self, url, method, **kwargs):
|
def _cs_request(self, url, method, **kwargs):
|
||||||
# Check that certain things are called correctly
|
# Check that certain things are called correctly
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
# The list of modules to copy from oslo-incubator
|
# The list of modules to copy from oslo-incubator
|
||||||
module=apiclient
|
module=apiclient
|
||||||
module=cliutils
|
module=cliutils
|
||||||
module=install_venv_common
|
|
||||||
|
|
||||||
# The base module to hold the copy of openstack.common
|
# The base module to hold the copy of openstack.common
|
||||||
base=novaclient
|
base=novaclient
|
||||||
|
Loading…
x
Reference in New Issue
Block a user