summaryrefslogtreecommitdiff
path: root/openstackclient/image
diff options
context:
space:
mode:
authorBrian Rosmaita <brian.rosmaita@rackspace.com>2017-01-20 23:15:12 +0000
committerSteve Martinelli <s.martinelli@gmail.com>2017-01-23 23:04:49 -0500
commit80c62021c829ceb878b8d51cedeca6fd6c688dd0 (patch)
treed908fa0bc9e7566525857373c96a9b51ce9b3bcc /openstackclient/image
parent64c509cf76fd9529c93a7b37e16630f84aa6d0ed (diff)
downloadpython-openstackclient-80c62021c829ceb878b8d51cedeca6fd6c688dd0.tar.gz
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
Diffstat (limited to 'openstackclient/image')
-rw-r--r--openstackclient/image/v1/image.py16
-rw-r--r--openstackclient/image/v2/image.py14
2 files changed, 20 insertions, 10 deletions
diff --git a/openstackclient/image/v1/image.py b/openstackclient/image/v1/image.py
index 1f239b67..f4944afa 100644
--- a/openstackclient/image/v1/image.py
+++ b/openstackclient/image/v1/image.py
@@ -36,6 +36,7 @@ from openstackclient.api import utils as api_utils
from openstackclient.i18n import _
+CONTAINER_CHOICES = ["ami", "ari", "aki", "bare", "docker", "ova", "ovf"]
DEFAULT_CONTAINER_FORMAT = 'bare'
DEFAULT_DISK_FORMAT = 'raw'
DISK_CHOICES = ["ami", "ari", "aki", "vhd", "vmdk", "raw", "qcow2", "vhdx",
@@ -84,8 +85,12 @@ class CreateImage(command.ShowOne):
"--container-format",
default=DEFAULT_CONTAINER_FORMAT,
metavar="<container-format>",
- help=_("Image container format "
- "(default: %s)") % DEFAULT_CONTAINER_FORMAT,
+ choices=CONTAINER_CHOICES,
+ 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(
"--disk-format",
@@ -498,13 +503,12 @@ class SetImage(command.Command):
type=int,
help=_("Minimum RAM size needed to boot image, in megabytes"),
)
- container_choices = ["ami", "ari", "aki", "bare", "ovf"]
parser.add_argument(
"--container-format",
metavar="<container-format>",
- help=_("Container format of image. Acceptable formats: %s") %
- container_choices,
- choices=container_choices
+ choices=CONTAINER_CHOICES,
+ help=_("Image container format. The supported options are: %s") %
+ ', '.join(CONTAINER_CHOICES)
)
parser.add_argument(
"--disk-format",
diff --git a/openstackclient/image/v2/image.py b/openstackclient/image/v2/image.py
index 418cc397..29499ec2 100644
--- a/openstackclient/image/v2/image.py
+++ b/openstackclient/image/v2/image.py
@@ -30,6 +30,7 @@ from openstackclient.i18n import _
from openstackclient.identity import common
+CONTAINER_CHOICES = ["ami", "ari", "aki", "bare", "docker", "ova", "ovf"]
DEFAULT_CONTAINER_FORMAT = 'bare'
DEFAULT_DISK_FORMAT = 'raw'
DISK_CHOICES = ["ami", "ari", "aki", "vhd", "vmdk", "raw", "qcow2", "vhdx",
@@ -135,9 +136,13 @@ class CreateImage(command.ShowOne):
parser.add_argument(
"--container-format",
default=DEFAULT_CONTAINER_FORMAT,
+ choices=CONTAINER_CHOICES,
metavar="<container-format>",
- help=_("Image container format "
- "(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(
"--disk-format",
@@ -659,8 +664,9 @@ class SetImage(command.Command):
parser.add_argument(
"--container-format",
metavar="<container-format>",
- help=_("Image container format "
- "(default: %s)") % DEFAULT_CONTAINER_FORMAT,
+ choices=CONTAINER_CHOICES,
+ help=_("Image container format. The supported options are: %s") %
+ ', '.join(CONTAINER_CHOICES)
)
parser.add_argument(
"--disk-format",