From b4402a0468ac1362f0928b37d5c7da54313c7668 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Mon, 28 Mar 2016 14:30:07 -0500 Subject: Docs cleanup: volume type Clean up volume type command help, add volume type show to doc, sort command classes in v1/volume_type.py. Change-Id: I1f8e5c047d9c08f5704fc23cfb694f23d32e3caf --- openstackclient/volume/v1/volume_type.py | 50 ++++++++++++++++---------------- openstackclient/volume/v2/volume_type.py | 10 +++---- 2 files changed, 30 insertions(+), 30 deletions(-) (limited to 'openstackclient/volume') diff --git a/openstackclient/volume/v1/volume_type.py b/openstackclient/volume/v1/volume_type.py index 24d0b235..05671c1f 100644 --- a/openstackclient/volume/v1/volume_type.py +++ b/openstackclient/volume/v1/volume_type.py @@ -30,13 +30,13 @@ class CreateVolumeType(command.ShowOne): parser.add_argument( 'name', metavar='', - help='New volume type name', + help='Volume type name', ) parser.add_argument( '--property', metavar='', action=parseractions.KeyValueAction, - help='Property to add for this volume type ' + help='Set a property on this volume type ' '(repeat option to set multiple properties)', ) return parser @@ -114,7 +114,7 @@ class SetVolumeType(command.Command): '--property', metavar='', action=parseractions.KeyValueAction, - help='Property to add or modify for this volume type ' + help='Set a property on this volume type ' '(repeat option to set multiple properties)', ) return parser @@ -128,6 +128,27 @@ class SetVolumeType(command.Command): volume_type.set_keys(parsed_args.property) +class ShowVolumeType(command.ShowOne): + """Display volume type details""" + + def get_parser(self, prog_name): + parser = super(ShowVolumeType, self).get_parser(prog_name) + parser.add_argument( + "volume_type", + metavar="", + help="Volume type to display (name or ID)" + ) + return parser + + def take_action(self, parsed_args): + volume_client = self.app.client_manager.volume + volume_type = utils.find_resource( + volume_client.volume_types, parsed_args.volume_type) + properties = utils.format_dict(volume_type._info.pop('extra_specs')) + volume_type._info.update({'properties': properties}) + return zip(*sorted(six.iteritems(volume_type._info))) + + class UnsetVolumeType(command.Command): """Unset volume type properties""" @@ -143,7 +164,7 @@ class UnsetVolumeType(command.Command): metavar='', action='append', default=[], - help='Property to remove from volume type ' + help='Remove a property from this volume type ' '(repeat option to remove multiple properties)', required=True, ) @@ -160,24 +181,3 @@ class UnsetVolumeType(command.Command): volume_type.unset_keys(parsed_args.property) else: self.app.log.error("No changes requested\n") - - -class ShowVolumeType(command.ShowOne): - """Display volume type details""" - - def get_parser(self, prog_name): - parser = super(ShowVolumeType, self).get_parser(prog_name) - parser.add_argument( - "volume_type", - metavar="", - help="Volume type to display (name or ID)" - ) - return parser - - def take_action(self, parsed_args): - volume_client = self.app.client_manager.volume - volume_type = utils.find_resource( - volume_client.volume_types, parsed_args.volume_type) - properties = utils.format_dict(volume_type._info.pop('extra_specs')) - volume_type._info.update({'properties': properties}) - return zip(*sorted(six.iteritems(volume_type._info))) diff --git a/openstackclient/volume/v2/volume_type.py b/openstackclient/volume/v2/volume_type.py index d2b3ed6a..5509ac52 100644 --- a/openstackclient/volume/v2/volume_type.py +++ b/openstackclient/volume/v2/volume_type.py @@ -29,12 +29,12 @@ class CreateVolumeType(command.ShowOne): parser.add_argument( "name", metavar="", - help="New volume type name" + help="Volume type name", ) parser.add_argument( "--description", metavar="", - help="New volume type description", + help="Volume type description", ) public_group = parser.add_mutually_exclusive_group() public_group.add_argument( @@ -55,7 +55,7 @@ class CreateVolumeType(command.ShowOne): '--property', metavar='', action=parseractions.KeyValueAction, - help='Property to add for this volume type' + help='Set a property on this volume type' '(repeat option to set multiple properties)', ) return parser @@ -153,7 +153,7 @@ class SetVolumeType(command.Command): '--property', metavar='', action=parseractions.KeyValueAction, - help='Property to add or modify for this volume type ' + help='Set a property on this volume type ' '(repeat option to set multiple properties)', ) return parser @@ -221,7 +221,7 @@ class UnsetVolumeType(command.Command): metavar='', default=[], required=True, - help='Property to remove from volume type ' + help='Remove a property from this volume type ' '(repeat option to remove multiple properties)', ) return parser -- cgit v1.2.1