Merge "Update container format choices"

This commit is contained in:
Jenkins 2017-01-24 15:30:08 +00:00 committed by Gerrit Code Review
commit 1ef0dae8b1
3 changed files with 24 additions and 12 deletions

View File

@ -76,7 +76,8 @@ Create/upload an image
.. option:: --container-format <container-format> .. option:: --container-format <container-format>
Image container format (default: bare) Image container format. The supported options are: ami, ari, aki,
bare, docker, ova, ovf. The default format is: bare
.. option:: --disk-format <disk-format> .. option:: --disk-format <disk-format>
@ -342,7 +343,8 @@ Set image properties
.. option:: --container-format <container-format> .. option:: --container-format <container-format>
Image container format (default: bare) Image container format. The supported options are: ami, ari, aki,
bare, docker, ova, ovf.
.. option:: --disk-format <disk-format> .. option:: --disk-format <disk-format>

View File

@ -36,6 +36,7 @@ from openstackclient.api import utils as api_utils
from openstackclient.i18n import _ from openstackclient.i18n import _
CONTAINER_CHOICES = ["ami", "ari", "aki", "bare", "docker", "ova", "ovf"]
DEFAULT_CONTAINER_FORMAT = 'bare' DEFAULT_CONTAINER_FORMAT = 'bare'
DEFAULT_DISK_FORMAT = 'raw' DEFAULT_DISK_FORMAT = 'raw'
DISK_CHOICES = ["ami", "ari", "aki", "vhd", "vmdk", "raw", "qcow2", "vhdx", DISK_CHOICES = ["ami", "ari", "aki", "vhd", "vmdk", "raw", "qcow2", "vhdx",
@ -84,8 +85,12 @@ class CreateImage(command.ShowOne):
"--container-format", "--container-format",
default=DEFAULT_CONTAINER_FORMAT, default=DEFAULT_CONTAINER_FORMAT,
metavar="<container-format>", metavar="<container-format>",
help=_("Image container format " choices=CONTAINER_CHOICES,
"(default: %s)") % DEFAULT_CONTAINER_FORMAT, help=(_("Image container format. "
"The supported options are: %(option_list)s. "
"The default format is: %(default_opt)s") %
{'option_list': ', '.join(CONTAINER_CHOICES),
'default_opt': DEFAULT_CONTAINER_FORMAT})
) )
parser.add_argument( parser.add_argument(
"--disk-format", "--disk-format",
@ -498,13 +503,12 @@ class SetImage(command.Command):
type=int, type=int,
help=_("Minimum RAM size needed to boot image, in megabytes"), help=_("Minimum RAM size needed to boot image, in megabytes"),
) )
container_choices = ["ami", "ari", "aki", "bare", "ovf"]
parser.add_argument( parser.add_argument(
"--container-format", "--container-format",
metavar="<container-format>", metavar="<container-format>",
help=_("Container format of image. Acceptable formats: %s") % choices=CONTAINER_CHOICES,
container_choices, help=_("Image container format. The supported options are: %s") %
choices=container_choices ', '.join(CONTAINER_CHOICES)
) )
parser.add_argument( parser.add_argument(
"--disk-format", "--disk-format",

View File

@ -30,6 +30,7 @@ from openstackclient.i18n import _
from openstackclient.identity import common from openstackclient.identity import common
CONTAINER_CHOICES = ["ami", "ari", "aki", "bare", "docker", "ova", "ovf"]
DEFAULT_CONTAINER_FORMAT = 'bare' DEFAULT_CONTAINER_FORMAT = 'bare'
DEFAULT_DISK_FORMAT = 'raw' DEFAULT_DISK_FORMAT = 'raw'
DISK_CHOICES = ["ami", "ari", "aki", "vhd", "vmdk", "raw", "qcow2", "vhdx", DISK_CHOICES = ["ami", "ari", "aki", "vhd", "vmdk", "raw", "qcow2", "vhdx",
@ -135,9 +136,13 @@ class CreateImage(command.ShowOne):
parser.add_argument( parser.add_argument(
"--container-format", "--container-format",
default=DEFAULT_CONTAINER_FORMAT, default=DEFAULT_CONTAINER_FORMAT,
choices=CONTAINER_CHOICES,
metavar="<container-format>", metavar="<container-format>",
help=_("Image container format " help=(_("Image container format. "
"(default: %s)") % DEFAULT_CONTAINER_FORMAT, "The supported options are: %(option_list)s. "
"The default format is: %(default_opt)s") %
{'option_list': ', '.join(CONTAINER_CHOICES),
'default_opt': DEFAULT_CONTAINER_FORMAT})
) )
parser.add_argument( parser.add_argument(
"--disk-format", "--disk-format",
@ -659,8 +664,9 @@ class SetImage(command.Command):
parser.add_argument( parser.add_argument(
"--container-format", "--container-format",
metavar="<container-format>", metavar="<container-format>",
help=_("Image container format " choices=CONTAINER_CHOICES,
"(default: %s)") % DEFAULT_CONTAINER_FORMAT, help=_("Image container format. The supported options are: %s") %
', '.join(CONTAINER_CHOICES)
) )
parser.add_argument( parser.add_argument(
"--disk-format", "--disk-format",