Browse Source

Fix the count error in zaqarclient

now count number didn't show in the result. Fix this bug.

Change-Id: I87788bf4b992e36119e8432d76ccaf66328cce42
tags/1.13.1^0
wanghao 4 months ago
parent
commit
4abbe7b451
2 changed files with 21 additions and 2 deletions
  1. +3
    -2
      zaqarclient/queues/v2/cli.py
  2. +18
    -0
      zaqarclient/queues/v2/client.py

+ 3
- 2
zaqarclient/queues/v2/cli.py View File

@@ -88,9 +88,10 @@ class ListQueues(command.Lister):
columns.extend(["Metadata_Dict", "Href"])
if parsed_args.with_count is not None and parsed_args.with_count:
kwargs["with_count"] = parsed_args.with_count
columns.extend(["Count"])

data = client.queues(**kwargs)
data, count = client.queues(**kwargs)
if count:
print("Queues in total: %s" % count)
columns = tuple(columns)
return (columns, (utils.get_item_properties(s, columns) for s in data))



+ 18
- 0
zaqarclient/queues/v2/client.py View File

@@ -56,6 +56,24 @@ class Client(client.Client):
"""
return queues.Queue(self, ref, **kwargs)

def queues(self, **params):
"""Gets a list of queues from the server

:returns: A list of queues
:rtype: `list`
"""
req, trans = self._request_and_transport()

queue_list = core.queue_list(trans, req, **params)

count = None
if params.get("with_count"):
count = queue_list.get("count", None)

return iterator._Iterator(self, queue_list, 'queues',
self.queues_module.create_object(self)),\
count

@decorators.version(min_version=2)
def subscription(self, queue_name, **kwargs):
"""Returns a subscription instance


Loading…
Cancel
Save