summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2021-08-30 15:58:38 +0000
committerGerrit Code Review <review@openstack.org>2021-08-30 15:58:38 +0000
commit0a685a7937e41006b8e5911db1b6bba98c0ad890 (patch)
tree709bdc4b7e10fe756f023dd3f8f37675306b400d
parent06c8a1e8ee8195e4d0027d90bedb00aad23939aa (diff)
parent14bc1360e05a8eeabe463426d9578131fce75c6f (diff)
downloadpython-cinderclient-0a685a7937e41006b8e5911db1b6bba98c0ad890.tar.gz
Merge "Fix list resources when use limit and with-count"
-rw-r--r--cinderclient/base.py6
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: