diff options
-rw-r--r-- | glanceclient/common/http.py | 1 | ||||
-rw-r--r-- | glanceclient/common/utils.py | 2 | ||||
-rw-r--r-- | glanceclient/shell.py | 2 | ||||
-rw-r--r-- | glanceclient/tests/unit/test_http.py | 14 | ||||
-rw-r--r-- | glanceclient/v1/shell.py | 2 | ||||
-rw-r--r-- | releasenotes/notes/sess_client_grid-3c2101609110f413.yaml | 6 |
6 files changed, 20 insertions, 7 deletions
diff --git a/glanceclient/common/http.py b/glanceclient/common/http.py index 6973f60..247b92d 100644 --- a/glanceclient/common/http.py +++ b/glanceclient/common/http.py @@ -352,7 +352,6 @@ class SessionClient(adapter.Adapter, _BaseHTTPClient): def __init__(self, session, **kwargs): kwargs.setdefault('user_agent', USER_AGENT) kwargs.setdefault('service_type', 'image') - self.global_request_id = kwargs.pop('global_request_id', None) super(SessionClient, self).__init__(session, **kwargs) def request(self, url, method, **kwargs): diff --git a/glanceclient/common/utils.py b/glanceclient/common/utils.py index 0fde763..d6d2268 100644 --- a/glanceclient/common/utils.py +++ b/glanceclient/common/utils.py @@ -13,8 +13,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import print_function - import errno import functools import hashlib diff --git a/glanceclient/shell.py b/glanceclient/shell.py index 3dfa14a..07bc394 100644 --- a/glanceclient/shell.py +++ b/glanceclient/shell.py @@ -17,8 +17,6 @@ Command-line interface to the OpenStack Images API. """ -from __future__ import print_function - import argparse import copy import getpass diff --git a/glanceclient/tests/unit/test_http.py b/glanceclient/tests/unit/test_http.py index 689074b..5759ccd 100644 --- a/glanceclient/tests/unit/test_http.py +++ b/glanceclient/tests/unit/test_http.py @@ -267,6 +267,20 @@ class TestClient(testtools.TestCase): self.assertEqual(b"application/openstack-images-v2.1-json-patch", ksarqh[b"Content-Type"]) + def test_request_id_header_session_client(self): + global_id = "req-%s" % uuid.uuid4() + kwargs = {'global_request_id': global_id} + auth = token_endpoint.Token(self.endpoint, self.token) + sess = session.Session(auth=auth) + http_client = http.SessionClient(sess, **kwargs) + + path = '/v2/images/my-image' + self.mock.get(self.endpoint + path) + http_client.get(path) + + headers = self.mock.last_request.headers + self.assertEqual(global_id, headers['X-OpenStack-Request-ID']) + def test_raw_request(self): """Verify the path being used for HTTP requests reflects accurately.""" headers = {"Content-Type": "text/plain"} diff --git a/glanceclient/v1/shell.py b/glanceclient/v1/shell.py index 8a4d29d..682ca98 100644 --- a/glanceclient/v1/shell.py +++ b/glanceclient/v1/shell.py @@ -13,8 +13,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import print_function - import copy import functools import os diff --git a/releasenotes/notes/sess_client_grid-3c2101609110f413.yaml b/releasenotes/notes/sess_client_grid-3c2101609110f413.yaml new file mode 100644 index 0000000..4552c43 --- /dev/null +++ b/releasenotes/notes/sess_client_grid-3c2101609110f413.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + * Bug 1886650_: Glance client does not correctly forward global request IDs + + .. _1886650: https://code.launchpad.net/bugs/1886650 |