diff options
author | Jenkins <jenkins@review.openstack.org> | 2016-02-27 16:35:16 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2016-02-27 16:35:16 +0000 |
commit | 580ed3f680e65b870e6c9d45ef951a9614ebd467 (patch) | |
tree | 253007319ac86ddab71ab3b3ef41d33b0151eb0d | |
parent | 53fc06dd813bddc43ea6ed1ac44512f07c51e64f (diff) | |
parent | 8c0f84f8ad9501c79988f7188dc7b7d67e958048 (diff) | |
download | python-cinderclient-580ed3f680e65b870e6c9d45ef951a9614ebd467.tar.gz |
Merge "Fix omission of request_ids returned to user"
-rw-r--r-- | cinderclient/base.py | 7 | ||||
-rw-r--r-- | cinderclient/tests/unit/test_utils.py | 10 |
2 files changed, 14 insertions, 3 deletions
diff --git a/cinderclient/base.py b/cinderclient/base.py index 78c6fd2..1358f7c 100644 --- a/cinderclient/base.py +++ b/cinderclient/base.py @@ -348,6 +348,7 @@ class ManagerWithFind(six.with_metaclass(abc.ABCMeta, Manager)): elif num_matches > 1: raise exceptions.NoUniqueMatch else: + matches[0].append_request_ids(matches.request_ids) return matches[0] def findall(self, **kwargs): @@ -370,13 +371,15 @@ class ManagerWithFind(six.with_metaclass(abc.ABCMeta, Manager)): elif 'display_name' in kwargs: search_opts['display_name'] = kwargs['display_name'] - found = [] + found = common_base.ListWithMeta([], None) searches = kwargs.items() + listing = self.list(search_opts=search_opts) + found.append_request_ids(listing.request_ids) # Not all resources attributes support filters on server side # (e.g. 'human_id' doesn't), so when doing findall some client # side filtering is still needed. - for obj in self.list(search_opts=search_opts): + for obj in listing: try: if all(getattr(obj, attr) == value for (attr, value) in searches): diff --git a/cinderclient/tests/unit/test_utils.py b/cinderclient/tests/unit/test_utils.py index 2d2ebd1..347a2d0 100644 --- a/cinderclient/tests/unit/test_utils.py +++ b/cinderclient/tests/unit/test_utils.py @@ -20,7 +20,9 @@ from six import moves from cinderclient import exceptions from cinderclient import utils from cinderclient import base +from cinderclient.openstack.common.apiclient import base as common_base from cinderclient.tests.unit import utils as test_utils +from cinderclient.tests.unit.v2 import fakes UUID = '8e8ec658-c7b0-4243-bdf8-6f7f2952c0d0' @@ -35,6 +37,9 @@ class FakeResource(object): except KeyError: pass + def append_request_ids(self, resp): + pass + class FakeManager(base.ManagerWithFind): @@ -53,7 +58,7 @@ class FakeManager(base.ManagerWithFind): raise exceptions.NotFound(resource_id) def list(self, search_opts): - return self.resources + return common_base.ListWithMeta(self.resources, fakes.REQUEST_ID) class FakeDisplayResource(object): @@ -66,6 +71,9 @@ class FakeDisplayResource(object): except KeyError: pass + def append_request_ids(self, resp): + pass + class FakeDisplayManager(FakeManager): |