Merge "CLI: support detailed in queue list"
This commit is contained in:
commit
6f8384e2b5
|
@ -87,6 +87,7 @@ openstack queue list
|
||||||
[--max-width <integer>] [--noindent]
|
[--max-width <integer>] [--noindent]
|
||||||
[--quote {all,minimal,none,nonnumeric}]
|
[--quote {all,minimal,none,nonnumeric}]
|
||||||
[--marker <queue_id>] [--limit <limit>]
|
[--marker <queue_id>] [--limit <limit>]
|
||||||
|
[--detailed]
|
||||||
|
|
||||||
List available queues.
|
List available queues.
|
||||||
|
|
||||||
|
@ -98,6 +99,9 @@ List available queues.
|
||||||
``--limit <limit>``
|
``--limit <limit>``
|
||||||
Page size limit.
|
Page size limit.
|
||||||
|
|
||||||
|
``--detailed``
|
||||||
|
If show detailed information of queue.
|
||||||
|
|
||||||
|
|
||||||
.. _openstack_queue_set_metadata:
|
.. _openstack_queue_set_metadata:
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
features:
|
||||||
|
- Support 'openstack queue list --detailed' in openstackclient to query the
|
||||||
|
detailed queue list from Zaqar server. The detailed information includes
|
||||||
|
queue's Name, Metadata and Href.
|
|
@ -85,21 +85,28 @@ class ListQueues(command.Lister):
|
||||||
"--limit",
|
"--limit",
|
||||||
metavar="<limit>",
|
metavar="<limit>",
|
||||||
help="Page size limit")
|
help="Page size limit")
|
||||||
|
parser.add_argument(
|
||||||
|
"--detailed",
|
||||||
|
action="store_true",
|
||||||
|
help="If show detailed information of queue")
|
||||||
|
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
client = _get_client(self, parsed_args)
|
client = _get_client(self, parsed_args)
|
||||||
kwargs = {}
|
kwargs = {}
|
||||||
|
columns = ["Name"]
|
||||||
if parsed_args.marker is not None:
|
if parsed_args.marker is not None:
|
||||||
kwargs["marker"] = parsed_args.marker
|
kwargs["marker"] = parsed_args.marker
|
||||||
if parsed_args.limit is not None:
|
if parsed_args.limit is not None:
|
||||||
kwargs["limit"] = parsed_args.limit
|
kwargs["limit"] = parsed_args.limit
|
||||||
|
if parsed_args.detailed is not None and parsed_args.detailed:
|
||||||
|
kwargs["detailed"] = parsed_args.detailed
|
||||||
|
columns.extend(["Metadata_Dict", "Href"])
|
||||||
|
|
||||||
data = client.queues(**kwargs)
|
data = client.queues(**kwargs)
|
||||||
columns = ("Name", )
|
columns = tuple(columns)
|
||||||
return (columns,
|
return (columns, (utils.get_item_properties(s, columns) for s in data))
|
||||||
(utils.get_item_properties(s, columns) for s in data))
|
|
||||||
|
|
||||||
|
|
||||||
class CheckQueueExistence(command.ShowOne):
|
class CheckQueueExistence(command.ShowOne):
|
||||||
|
|
|
@ -25,7 +25,8 @@ class Queue(object):
|
||||||
|
|
||||||
message_module = message
|
message_module = message
|
||||||
|
|
||||||
def __init__(self, client, name, auto_create=True, force_create=False):
|
def __init__(self, client, name, href=None, metadata=None,
|
||||||
|
auto_create=True, force_create=False):
|
||||||
"""Initialize queue object
|
"""Initialize queue object
|
||||||
|
|
||||||
:param client: The client object of Zaqar.
|
:param client: The client object of Zaqar.
|
||||||
|
@ -46,7 +47,8 @@ class Queue(object):
|
||||||
|
|
||||||
# NOTE(flaper87) Queue Info
|
# NOTE(flaper87) Queue Info
|
||||||
self._name = name
|
self._name = name
|
||||||
self._metadata = None
|
self._metadata = metadata
|
||||||
|
self._href = href
|
||||||
|
|
||||||
# NOTE(flwang): If force_create is True, then even though auto_create
|
# NOTE(flwang): If force_create is True, then even though auto_create
|
||||||
# is not True, the queue should be created anyway.
|
# is not True, the queue should be created anyway.
|
||||||
|
@ -57,6 +59,14 @@ class Queue(object):
|
||||||
def name(self):
|
def name(self):
|
||||||
return self._name
|
return self._name
|
||||||
|
|
||||||
|
@property
|
||||||
|
def href(self):
|
||||||
|
return self._href
|
||||||
|
|
||||||
|
@property
|
||||||
|
def metadata_dict(self):
|
||||||
|
return dict(self.metadata())
|
||||||
|
|
||||||
def exists(self):
|
def exists(self):
|
||||||
"""Checks if the queue exists."""
|
"""Checks if the queue exists."""
|
||||||
req, trans = self.client._request_and_transport()
|
req, trans = self.client._request_and_transport()
|
||||||
|
|
|
@ -90,4 +90,5 @@ class Queue(queues.Queue):
|
||||||
|
|
||||||
|
|
||||||
def create_object(parent):
|
def create_object(parent):
|
||||||
return lambda args: Queue(parent, args["name"], auto_create=False)
|
return lambda args: Queue(parent, args["name"], href=args.get("href"),
|
||||||
|
metadata=args.get("metadata"), auto_create=False)
|
||||||
|
|
Loading…
Reference in New Issue