Skip to content

Commit 80c6202

Browse files
Brian Rosmaitastevemar
authored andcommitted
Update container format choices
The choices for valid container formats is out of date in the image v1 and v2 help text. This patch adds 'ova' and 'docker' and does some minor refactoring to align the container_format option with the disk_format option. Change-Id: Icdea5fab801abd651baf45cf96c920c7df79f11b Closes-bug: #1658138
1 parent 64c509c commit 80c6202

3 files changed

Lines changed: 24 additions & 12 deletions

File tree

doc/source/command-objects/image.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ Create/upload an image
7676
7777
.. option:: --container-format <container-format>
7878
79-
Image container format (default: bare)
79+
Image container format. The supported options are: ami, ari, aki,
80+
bare, docker, ova, ovf. The default format is: bare
8081
8182
.. option:: --disk-format <disk-format>
8283
@@ -342,7 +343,8 @@ Set image properties
342343
343344
.. option:: --container-format <container-format>
344345
345-
Image container format (default: bare)
346+
Image container format. The supported options are: ami, ari, aki,
347+
bare, docker, ova, ovf.
346348
347349
.. option:: --disk-format <disk-format>
348350

openstackclient/image/v1/image.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
from openstackclient.i18n import _
3737

3838

39+
CONTAINER_CHOICES = ["ami", "ari", "aki", "bare", "docker", "ova", "ovf"]
3940
DEFAULT_CONTAINER_FORMAT = 'bare'
4041
DEFAULT_DISK_FORMAT = 'raw'
4142
DISK_CHOICES = ["ami", "ari", "aki", "vhd", "vmdk", "raw", "qcow2", "vhdx",
@@ -84,8 +85,12 @@ def get_parser(self, prog_name):
8485
"--container-format",
8586
default=DEFAULT_CONTAINER_FORMAT,
8687
metavar="<container-format>",
87-
help=_("Image container format "
88-
"(default: %s)") % DEFAULT_CONTAINER_FORMAT,
88+
choices=CONTAINER_CHOICES,
89+
help=(_("Image container format. "
90+
"The supported options are: %(option_list)s. "
91+
"The default format is: %(default_opt)s") %
92+
{'option_list': ', '.join(CONTAINER_CHOICES),
93+
'default_opt': DEFAULT_CONTAINER_FORMAT})
8994
)
9095
parser.add_argument(
9196
"--disk-format",
@@ -498,13 +503,12 @@ def get_parser(self, prog_name):
498503
type=int,
499504
help=_("Minimum RAM size needed to boot image, in megabytes"),
500505
)
501-
container_choices = ["ami", "ari", "aki", "bare", "ovf"]
502506
parser.add_argument(
503507
"--container-format",
504508
metavar="<container-format>",
505-
help=_("Container format of image. Acceptable formats: %s") %
506-
container_choices,
507-
choices=container_choices
509+
choices=CONTAINER_CHOICES,
510+
help=_("Image container format. The supported options are: %s") %
511+
', '.join(CONTAINER_CHOICES)
508512
)
509513
parser.add_argument(
510514
"--disk-format",

openstackclient/image/v2/image.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
from openstackclient.identity import common
3131

3232

33+
CONTAINER_CHOICES = ["ami", "ari", "aki", "bare", "docker", "ova", "ovf"]
3334
DEFAULT_CONTAINER_FORMAT = 'bare'
3435
DEFAULT_DISK_FORMAT = 'raw'
3536
DISK_CHOICES = ["ami", "ari", "aki", "vhd", "vmdk", "raw", "qcow2", "vhdx",
@@ -135,9 +136,13 @@ def get_parser(self, prog_name):
135136
parser.add_argument(
136137
"--container-format",
137138
default=DEFAULT_CONTAINER_FORMAT,
139+
choices=CONTAINER_CHOICES,
138140
metavar="<container-format>",
139-
help=_("Image container format "
140-
"(default: %s)") % DEFAULT_CONTAINER_FORMAT,
141+
help=(_("Image container format. "
142+
"The supported options are: %(option_list)s. "
143+
"The default format is: %(default_opt)s") %
144+
{'option_list': ', '.join(CONTAINER_CHOICES),
145+
'default_opt': DEFAULT_CONTAINER_FORMAT})
141146
)
142147
parser.add_argument(
143148
"--disk-format",
@@ -659,8 +664,9 @@ def get_parser(self, prog_name):
659664
parser.add_argument(
660665
"--container-format",
661666
metavar="<container-format>",
662-
help=_("Image container format "
663-
"(default: %s)") % DEFAULT_CONTAINER_FORMAT,
667+
choices=CONTAINER_CHOICES,
668+
help=_("Image container format. The supported options are: %s") %
669+
', '.join(CONTAINER_CHOICES)
664670
)
665671
parser.add_argument(
666672
"--disk-format",

0 commit comments

Comments
 (0)