Merge "clean up image choices and help text"
This commit is contained in:
commit
2de45c2805
doc/source/command-objects
openstackclient
@ -78,7 +78,8 @@ Create/upload an image
|
|||||||
|
|
||||||
.. option:: --disk-format <disk-format>
|
.. option:: --disk-format <disk-format>
|
||||||
|
|
||||||
Image disk format (default: raw)
|
Image disk format. The supported options are: ami, ari, aki, vhd, vmdk,
|
||||||
|
raw, qcow2, vhdx, vdi, and iso. The default format is: raw
|
||||||
|
|
||||||
.. option:: --size <size>
|
.. option:: --size <size>
|
||||||
|
|
||||||
@ -337,7 +338,8 @@ Set image properties
|
|||||||
|
|
||||||
.. option:: --disk-format <disk-format>
|
.. option:: --disk-format <disk-format>
|
||||||
|
|
||||||
Image disk format (default: raw)
|
Image disk format. The supported options are: ami, ari, aki, vhd, vmdk,
|
||||||
|
raw, qcow2, vhdx, vdi, and iso.
|
||||||
|
|
||||||
.. option:: --size <size>
|
.. option:: --size <size>
|
||||||
|
|
||||||
|
@ -38,6 +38,8 @@ from openstackclient.i18n import _
|
|||||||
|
|
||||||
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",
|
||||||
|
"vdi", "iso"]
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
@ -89,8 +91,9 @@ class CreateImage(command.ShowOne):
|
|||||||
"--disk-format",
|
"--disk-format",
|
||||||
default=DEFAULT_DISK_FORMAT,
|
default=DEFAULT_DISK_FORMAT,
|
||||||
metavar="<disk-format>",
|
metavar="<disk-format>",
|
||||||
help=_("Image disk format "
|
choices=DISK_CHOICES,
|
||||||
"(default: %s)") % DEFAULT_DISK_FORMAT,
|
help=_("Image disk format. The supported options are: %s. "
|
||||||
|
"The default format is: raw") % ', '.join(DISK_CHOICES)
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--size",
|
"--size",
|
||||||
@ -502,14 +505,12 @@ class SetImage(command.Command):
|
|||||||
container_choices,
|
container_choices,
|
||||||
choices=container_choices
|
choices=container_choices
|
||||||
)
|
)
|
||||||
disk_choices = ["ami", "ari", "aki", "vhd", "vmdk", "raw", "qcow2",
|
|
||||||
"vhdx", "vdi", "iso"]
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--disk-format",
|
"--disk-format",
|
||||||
metavar="<disk-format>",
|
metavar="<disk-format>",
|
||||||
help=_("Disk format of image. Acceptable formats: %s") %
|
choices=DISK_CHOICES,
|
||||||
disk_choices,
|
help=_("Image disk format. The supported options are: %s.") %
|
||||||
choices=disk_choices
|
', '.join(DISK_CHOICES)
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--size",
|
"--size",
|
||||||
|
@ -32,6 +32,8 @@ from openstackclient.identity import common
|
|||||||
|
|
||||||
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",
|
||||||
|
"vdi", "iso"]
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
@ -140,9 +142,10 @@ class CreateImage(command.ShowOne):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--disk-format",
|
"--disk-format",
|
||||||
default=DEFAULT_DISK_FORMAT,
|
default=DEFAULT_DISK_FORMAT,
|
||||||
|
choices=DISK_CHOICES,
|
||||||
metavar="<disk-format>",
|
metavar="<disk-format>",
|
||||||
help=_("Image disk format "
|
help=_("Image disk format. The supported options are: %s. "
|
||||||
"(default: %s)") % DEFAULT_DISK_FORMAT,
|
"The default format is: raw") % ', '.join(DISK_CHOICES)
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--min-disk",
|
"--min-disk",
|
||||||
@ -650,8 +653,9 @@ class SetImage(command.Command):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--disk-format",
|
"--disk-format",
|
||||||
metavar="<disk-format>",
|
metavar="<disk-format>",
|
||||||
help=_("Image disk format "
|
choices=DISK_CHOICES,
|
||||||
"(default: %s)") % DEFAULT_DISK_FORMAT,
|
help=_("Image disk format. The supported options are: %s") %
|
||||||
|
', '.join(DISK_CHOICES)
|
||||||
)
|
)
|
||||||
protected_group = parser.add_mutually_exclusive_group()
|
protected_group = parser.add_mutually_exclusive_group()
|
||||||
protected_group.add_argument(
|
protected_group.add_argument(
|
||||||
|
@ -116,7 +116,7 @@ class TestImageCreate(TestImage):
|
|||||||
self.images_mock.configure_mock(**mock_exception)
|
self.images_mock.configure_mock(**mock_exception)
|
||||||
arglist = [
|
arglist = [
|
||||||
'--container-format', 'ovf',
|
'--container-format', 'ovf',
|
||||||
'--disk-format', 'fs',
|
'--disk-format', 'ami',
|
||||||
'--min-disk', '10',
|
'--min-disk', '10',
|
||||||
'--min-ram', '4',
|
'--min-ram', '4',
|
||||||
'--protected',
|
'--protected',
|
||||||
@ -126,7 +126,7 @@ class TestImageCreate(TestImage):
|
|||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('container_format', 'ovf'),
|
('container_format', 'ovf'),
|
||||||
('disk_format', 'fs'),
|
('disk_format', 'ami'),
|
||||||
('min_disk', 10),
|
('min_disk', 10),
|
||||||
('min_ram', 4),
|
('min_ram', 4),
|
||||||
('protected', True),
|
('protected', True),
|
||||||
@ -147,7 +147,7 @@ class TestImageCreate(TestImage):
|
|||||||
self.images_mock.create.assert_called_with(
|
self.images_mock.create.assert_called_with(
|
||||||
name=self.new_image.name,
|
name=self.new_image.name,
|
||||||
container_format='ovf',
|
container_format='ovf',
|
||||||
disk_format='fs',
|
disk_format='ami',
|
||||||
min_disk=10,
|
min_disk=10,
|
||||||
min_ram=4,
|
min_ram=4,
|
||||||
protected=True,
|
protected=True,
|
||||||
|
@ -130,7 +130,7 @@ class TestImageCreate(TestImage):
|
|||||||
self.images_mock.configure_mock(**mock_exception)
|
self.images_mock.configure_mock(**mock_exception)
|
||||||
arglist = [
|
arglist = [
|
||||||
'--container-format', 'ovf',
|
'--container-format', 'ovf',
|
||||||
'--disk-format', 'fs',
|
'--disk-format', 'ami',
|
||||||
'--min-disk', '10',
|
'--min-disk', '10',
|
||||||
'--min-ram', '4',
|
'--min-ram', '4',
|
||||||
('--protected'
|
('--protected'
|
||||||
@ -143,7 +143,7 @@ class TestImageCreate(TestImage):
|
|||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('container_format', 'ovf'),
|
('container_format', 'ovf'),
|
||||||
('disk_format', 'fs'),
|
('disk_format', 'ami'),
|
||||||
('min_disk', 10),
|
('min_disk', 10),
|
||||||
('min_ram', 4),
|
('min_ram', 4),
|
||||||
('protected', self.new_image.protected),
|
('protected', self.new_image.protected),
|
||||||
@ -165,7 +165,7 @@ class TestImageCreate(TestImage):
|
|||||||
self.images_mock.create.assert_called_with(
|
self.images_mock.create.assert_called_with(
|
||||||
name=self.new_image.name,
|
name=self.new_image.name,
|
||||||
container_format='ovf',
|
container_format='ovf',
|
||||||
disk_format='fs',
|
disk_format='ami',
|
||||||
min_disk=10,
|
min_disk=10,
|
||||||
min_ram=4,
|
min_ram=4,
|
||||||
owner=self.project.id,
|
owner=self.project.id,
|
||||||
@ -193,7 +193,7 @@ class TestImageCreate(TestImage):
|
|||||||
|
|
||||||
arglist = [
|
arglist = [
|
||||||
'--container-format', 'ovf',
|
'--container-format', 'ovf',
|
||||||
'--disk-format', 'fs',
|
'--disk-format', 'ami',
|
||||||
'--min-disk', '10',
|
'--min-disk', '10',
|
||||||
'--min-ram', '4',
|
'--min-ram', '4',
|
||||||
'--owner', 'unexist_owner',
|
'--owner', 'unexist_owner',
|
||||||
@ -203,7 +203,7 @@ class TestImageCreate(TestImage):
|
|||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('container_format', 'ovf'),
|
('container_format', 'ovf'),
|
||||||
('disk_format', 'fs'),
|
('disk_format', 'ami'),
|
||||||
('min_disk', 10),
|
('min_disk', 10),
|
||||||
('min_ram', 4),
|
('min_ram', 4),
|
||||||
('owner', 'unexist_owner'),
|
('owner', 'unexist_owner'),
|
||||||
@ -227,7 +227,7 @@ class TestImageCreate(TestImage):
|
|||||||
|
|
||||||
arglist = [
|
arglist = [
|
||||||
'--container-format', 'ovf',
|
'--container-format', 'ovf',
|
||||||
'--disk-format', 'fs',
|
'--disk-format', 'ami',
|
||||||
'--min-disk', '10',
|
'--min-disk', '10',
|
||||||
'--min-ram', '4',
|
'--min-ram', '4',
|
||||||
'--protected',
|
'--protected',
|
||||||
@ -237,7 +237,7 @@ class TestImageCreate(TestImage):
|
|||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('container_format', 'ovf'),
|
('container_format', 'ovf'),
|
||||||
('disk_format', 'fs'),
|
('disk_format', 'ami'),
|
||||||
('min_disk', 10),
|
('min_disk', 10),
|
||||||
('min_ram', 4),
|
('min_ram', 4),
|
||||||
('protected', True),
|
('protected', True),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user