From 989485c7f9f685fc2d0fc2c6e7786a087a6042ac Mon Sep 17 00:00:00 2001 From: Dean Troyer <dtroyer@gmail.com> Date: Sun, 24 Feb 2013 20:00:39 -0600 Subject: [PATCH] Change create flavor to use default arguments Most of the arguments required by the create flavor API can have reasonable defaults and therefore can be made optional in the CLI. This brings create flavor in line with the documented args in the wiki at https://wiki.openstack.org/wiki/UnifiedCLI/Mapping#flavor Change-Id: Iecb3baf72f9dc3981742ff7989780894e37921c9 --- openstackclient/compute/v2/flavor.py | 48 +++++++++++++++------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/openstackclient/compute/v2/flavor.py b/openstackclient/compute/v2/flavor.py index 40418132e7..0b48da86de 100644 --- a/openstackclient/compute/v2/flavor.py +++ b/openstackclient/compute/v2/flavor.py @@ -38,37 +38,41 @@ class CreateFlavor(show.ShowOne): metavar="<name>", help="Name of the new flavor") parser.add_argument( - "id", + "--id", metavar="<id>", - help="Unique ID (integer or UUID) for the new flavor." - " If specifying 'auto', a UUID will be generated as id") + default='auto', + help="Unique flavor ID; 'auto' will create a UUID " + "(default: auto)") parser.add_argument( - "ram", + "--ram", type=int, - metavar="<ram>", - help="Memory size in MB") + metavar="<size-mb>", + default=256, + help="Memory size in MB (default 256M)") parser.add_argument( - "disk", + "--disk", type=int, - metavar="<disk>", - help="Disk size in GB") + metavar="<size-gb>", + default=0, + help="Disk size in GB (default 0G)") parser.add_argument( "--ephemeral", type=int, - metavar="<ephemeral>", - help="Ephemeral space size in GB (default 0)", + metavar="<size-gb>", + help="Ephemeral disk size in GB (default 0G)", default=0) - parser.add_argument( - "vcpus", - type=int, - metavar="<vcpus>", - help="Number of vcpus") parser.add_argument( "--swap", type=int, - metavar="<swap>", - help="Swap space size in MB (default 0)", + metavar="<size-gb>", + help="Swap space size in GB (default 0G)", default=0) + parser.add_argument( + "--vcpus", + type=int, + metavar="<vcpus>", + default=1, + help="Number of vcpus (default 1)") parser.add_argument( "--rxtx-factor", type=int, @@ -79,14 +83,14 @@ class CreateFlavor(show.ShowOne): public_group.add_argument( "--public", dest="public", + action="store_true", default=True, - help="Make flavor inaccessible to the public (default)", - action="store_true") + help="Flavor is accessible to the public (default)") public_group.add_argument( "--private", dest="public", - help="Make flavor inaccessible to the public", - action="store_false") + action="store_false", + help="Flavor is inaccessible to the public") return parser def take_action(self, parsed_args):