diff options
| author | Steve Martinelli <s.martinelli@gmail.com> | 2016-11-09 16:01:33 -0500 |
|---|---|---|
| committer | Jaspreet Singh Rawel <jaspreetsinghrawel@gmail.com> | 2016-11-23 22:52:33 +0530 |
| commit | f15352f8613d73b003abc5fe4da9ff23229895c8 (patch) | |
| tree | 500b22f69643af4f2edee7c17fc73e3ba0cd0924 /openstackclient/image/v1 | |
| parent | 3a7bb859a67ed82b30be23f626e271da85970590 (diff) | |
| download | python-openstackclient-f15352f8613d73b003abc5fe4da9ff23229895c8.tar.gz | |
clean up image choices and help text
Use choices for image set and image create commands, this aligns
with our use of choices in networking commands.
Also update the help text to match that of the networking
commands, where we iterate through the options.
Related-Bug: 1635518
Change-Id: Ib4c66b06e07f1d4e5bfe1b74053f2215cccad890
Diffstat (limited to 'openstackclient/image/v1')
| -rw-r--r-- | openstackclient/image/v1/image.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/openstackclient/image/v1/image.py b/openstackclient/image/v1/image.py index cf389d17..0d54e339 100644 --- a/openstackclient/image/v1/image.py +++ b/openstackclient/image/v1/image.py @@ -38,6 +38,8 @@ from openstackclient.i18n import _ DEFAULT_CONTAINER_FORMAT = 'bare' DEFAULT_DISK_FORMAT = 'raw' +DISK_CHOICES = ["ami", "ari", "aki", "vhd", "vmdk", "raw", "qcow2", "vhdx", + "vdi", "iso"] LOG = logging.getLogger(__name__) @@ -89,8 +91,9 @@ class CreateImage(command.ShowOne): "--disk-format", default=DEFAULT_DISK_FORMAT, metavar="<disk-format>", - help=_("Image disk format " - "(default: %s)") % DEFAULT_DISK_FORMAT, + choices=DISK_CHOICES, + help=_("Image disk format. The supported options are: %s. " + "The default format is: raw") % ', '.join(DISK_CHOICES) ) parser.add_argument( "--size", @@ -502,14 +505,12 @@ class SetImage(command.Command): container_choices, choices=container_choices ) - disk_choices = ["ami", "ari", "aki", "vhd", "vmdk", "raw", "qcow2", - "vhdx", "vdi", "iso"] parser.add_argument( "--disk-format", metavar="<disk-format>", - help=_("Disk format of image. Acceptable formats: %s") % - disk_choices, - choices=disk_choices + choices=DISK_CHOICES, + help=_("Image disk format. The supported options are: %s.") % + ', '.join(DISK_CHOICES) ) parser.add_argument( "--size", |
