diff --git a/cinderclient/base.py b/cinderclient/base.py index 36e7df89e..78c6fd2ef 100644 --- a/cinderclient/base.py +++ b/cinderclient/base.py @@ -307,7 +307,7 @@ class Manager(common_base.HookableMixin): def _delete(self, url): resp, body = self.api.client.delete(url) - return common_base.TupleWithMeta(resp, body) + return common_base.TupleWithMeta((resp, body), resp) def _update(self, url, body, response_key=None, **kwargs): self.run_hooks('modify_body_for_update', body, **kwargs) diff --git a/cinderclient/openstack/common/apiclient/base.py b/cinderclient/openstack/common/apiclient/base.py index abfcdfe7a..3645f6874 100644 --- a/cinderclient/openstack/common/apiclient/base.py +++ b/cinderclient/openstack/common/apiclient/base.py @@ -551,9 +551,9 @@ class DictWithMeta(dict, RequestIdMixin): class TupleWithMeta(tuple, RequestIdMixin): - def __new__(cls, resp, values): - return super(TupleWithMeta, cls).__new__(cls, (resp, values)) + def __new__(cls, values, resp): + return super(TupleWithMeta, cls).__new__(cls, values) - def __init__(self, resp, values): + def __init__(self, values, resp): self.setup() self.append_request_ids(resp) diff --git a/cinderclient/tests/unit/test_base.py b/cinderclient/tests/unit/test_base.py index 7d329dedc..67265a78e 100644 --- a/cinderclient/tests/unit/test_base.py +++ b/cinderclient/tests/unit/test_base.py @@ -106,8 +106,8 @@ class DictWithMetaTest(utils.TestCase): class TupleWithMetaTest(utils.TestCase): def test_tuple_with_meta(self): resp = create_response_obj_with_header() - obj = common_base.TupleWithMeta(resp, None) - self.assertIsInstance(obj, tuple) + obj = common_base.TupleWithMeta((), resp) + self.assertEqual((), obj) # Check request_ids attribute is added to obj self.assertTrue(hasattr(obj, 'request_ids')) self.assertEqual([REQUEST_ID], obj.request_ids)