Added pool show support to v1

This patch will add pool show
support in zaqar client v1.

Change-Id: I5c683ab30161a6adfc886c45916b7f706cd0f739
This commit is contained in:
Md Nadeem 2015-11-19 11:39:34 +09:00
parent cbcfb60a79
commit 603e22a4d1
3 changed files with 28 additions and 0 deletions

View File

@ -57,6 +57,7 @@ openstack.messaging.v1 =
queue_get_metadata = zaqarclient.queues.v1.cli:GetQueueMetadata
queue_stats = zaqarclient.queues.v1.cli:GetQueueStats
pool_create = zaqarclient.queues.v1.cli:CreatePool
pool_show = zaqarclient.queues.v1.cli:ShowPool
messaging_flavor_delete = zaqarclient.queues.v1.cli:DeleteFlavor
openstack.cli.extension =

View File

@ -273,6 +273,29 @@ class CreatePool(show.ShowOne):
return columns, utils.get_item_properties(data, columns)
class ShowPool(show.ShowOne):
"""Display pool details"""
log = logging.getLogger(__name__ + ".ShowPool")
def get_parser(self, prog_name):
parser = super(ShowPool, self).get_parser(prog_name)
parser.add_argument(
"pool_name",
metavar="<pool_name>",
help="Pool to display (name)",
)
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
client = self.app.client_manager.messaging
pool_data = client.pool(parsed_args.pool_name,
auto_create=False).get()
columns = ('Name', 'Weight', 'URI', 'Group', 'Options')
return columns, utils.get_dict_properties(pool_data, columns)
class DeleteFlavor(command.Command):
"""Delete a flavor."""

View File

@ -72,6 +72,10 @@ class Pool(object):
req, trans = self.client._request_and_transport()
core.pool_delete(trans, req, self.name)
def get(self):
req, trans = self.client._request_and_transport()
return core.pool_get(trans, req, self.name, callback=None)
def create_object(parent):
return lambda args: Pool(parent, args["name"], auto_create=False)