summaryrefslogtreecommitdiff
path: root/openstackclient/image
diff options
context:
space:
mode:
authorDavid Rabel <rabel@b1-systems.de>2017-02-23 12:10:51 +0100
committerDavid Rabel <rabel@b1-systems.de>2017-02-24 08:50:37 +0100
commit4ea4f6fabb5bd45f15f21fc5d84f0f85032e4f23 (patch)
tree3fef86646176e20316be1f6fdda391adf938c052 /openstackclient/image
parent1450e8ff4f0075076dcb562628ae8f1ee69de5da (diff)
downloadpython-openstackclient-4ea4f6fabb5bd45f15f21fc5d84f0f85032e4f23.tar.gz
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
Diffstat (limited to 'openstackclient/image')
-rw-r--r--openstackclient/image/v1/image.py5
-rw-r--r--openstackclient/image/v2/image.py5
2 files changed, 6 insertions, 4 deletions
diff --git a/openstackclient/image/v1/image.py b/openstackclient/image/v1/image.py
index f4944afa..60d61709 100644
--- a/openstackclient/image/v1/image.py
+++ b/openstackclient/image/v1/image.py
@@ -128,12 +128,13 @@ class CreateImage(command.ShowOne):
metavar="<image-url>",
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",
metavar="<file>",
help=_("Upload image from local file"),
)
- parser.add_argument(
+ source_group.add_argument(
"--volume",
metavar="<volume>",
help=_("Create image from a volume"),
diff --git a/openstackclient/image/v2/image.py b/openstackclient/image/v2/image.py
index 29499ec2..c4be69f0 100644
--- a/openstackclient/image/v2/image.py
+++ b/openstackclient/image/v2/image.py
@@ -164,12 +164,13 @@ class CreateImage(command.ShowOne):
type=int,
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",
metavar="<file>",
help=_("Upload image from local file"),
)
- parser.add_argument(
+ source_group.add_argument(
"--volume",
metavar="<volume>",
help=_("Create image from a volume"),