openstack image create : --file and --volume exclude each other

Added parser.add_mutually_exclusive_group() for --file and --volume
in openstack image create.

Change-Id: I4d9fc6314801d569354e5644e231ddd6c7f1853d
Closes-Bug: 1666551
This commit is contained in:
David Rabel 2017-02-23 12:10:51 +01:00
parent 1450e8ff4f
commit 4ea4f6fabb
2 changed files with 6 additions and 4 deletions

View File

@ -128,12 +128,13 @@ class CreateImage(command.ShowOne):
metavar="<image-url>", metavar="<image-url>",
help=_("Copy image from the data store (similar to --location)"), help=_("Copy image from the data store (similar to --location)"),
) )
parser.add_argument( source_group = parser.add_mutually_exclusive_group()
source_group.add_argument(
"--file", "--file",
metavar="<file>", metavar="<file>",
help=_("Upload image from local file"), help=_("Upload image from local file"),
) )
parser.add_argument( source_group.add_argument(
"--volume", "--volume",
metavar="<volume>", metavar="<volume>",
help=_("Create image from a volume"), help=_("Create image from a volume"),

View File

@ -164,12 +164,13 @@ class CreateImage(command.ShowOne):
type=int, type=int,
help=_("Minimum RAM size needed to boot image, in megabytes"), help=_("Minimum RAM size needed to boot image, in megabytes"),
) )
parser.add_argument( source_group = parser.add_mutually_exclusive_group()
source_group.add_argument(
"--file", "--file",
metavar="<file>", metavar="<file>",
help=_("Upload image from local file"), help=_("Upload image from local file"),
) )
parser.add_argument( source_group.add_argument(
"--volume", "--volume",
metavar="<volume>", metavar="<volume>",
help=_("Create image from a volume"), help=_("Create image from a volume"),