From 4ea4f6fabb5bd45f15f21fc5d84f0f85032e4f23 Mon Sep 17 00:00:00 2001 From: David Rabel Date: Thu, 23 Feb 2017 12:10:51 +0100 Subject: [PATCH] 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 --- openstackclient/image/v1/image.py | 5 +++-- openstackclient/image/v2/image.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/openstackclient/image/v1/image.py b/openstackclient/image/v1/image.py index f4944afa6f..60d6170901 100644 --- a/openstackclient/image/v1/image.py +++ b/openstackclient/image/v1/image.py @@ -128,12 +128,13 @@ class CreateImage(command.ShowOne): metavar="", 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="", help=_("Upload image from local file"), ) - parser.add_argument( + source_group.add_argument( "--volume", metavar="", help=_("Create image from a volume"), diff --git a/openstackclient/image/v2/image.py b/openstackclient/image/v2/image.py index 29499ec2c8..c4be69f055 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="", help=_("Upload image from local file"), ) - parser.add_argument( + source_group.add_argument( "--volume", metavar="", help=_("Create image from a volume"),