diff options
author | Zuul <zuul@review.opendev.org> | 2021-08-30 15:58:38 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2021-08-30 15:58:38 +0000 |
commit | 0a685a7937e41006b8e5911db1b6bba98c0ad890 (patch) | |
tree | 709bdc4b7e10fe756f023dd3f8f37675306b400d | |
parent | 06c8a1e8ee8195e4d0027d90bedb00aad23939aa (diff) | |
parent | 14bc1360e05a8eeabe463426d9578131fce75c6f (diff) | |
download | python-cinderclient-0a685a7937e41006b8e5911db1b6bba98c0ad890.tar.gz |
Merge "Fix list resources when use limit and with-count"
-rw-r--r-- | cinderclient/base.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/cinderclient/base.py b/cinderclient/base.py index f86a3a8..a99b29c 100644 --- a/cinderclient/base.py +++ b/cinderclient/base.py @@ -123,6 +123,12 @@ class Manager(common_base.HookableMixin): # till there is no more items. items = self._list(next, response_key, obj_class, None, limit, items) + # If we use '--with-count' to get the resource count, + # the _list function will return the tuple result with + # (resources, count). + # So here, we must check the items' type then to do return. + if isinstance(items, tuple): + items = items[0] if "count" in body: return common_base.ListWithMeta(items, resp), body['count'] else: |