Merge "Fix list resources when use limit and with-count"

This commit is contained in:
Zuul 2021-08-30 15:58:38 +00:00 committed by Gerrit Code Review
commit 0a685a7937
1 changed files with 6 additions and 0 deletions

View File

@ -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: