From 4464109c7754a9287f75ec2af84398700d1450e6 Mon Sep 17 00:00:00 2001 From: ShogoAdachi Date: Thu, 7 Sep 2017 19:10:24 +0900 Subject: Accept 0 for --min-disk and --min-ram The current openstackclient implementation cannot accept 0 for --min-disk and --min-ram with the "openstack image set" command. If theses options get set to 0, the option parser in openstackclient wrongly interprets 0 as no option value. The 0 is valid for these options if administrators want to make it the default(no minimum requirements). This patch fix the parser so that it avoids only 'None'. Change-Id: Ie8ee37484c02c26f54adc56263fcd167c0ce7eb3 Closes-bug: #1719499 --- openstackclient/image/v2/image.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'openstackclient/image/v2') diff --git a/openstackclient/image/v2/image.py b/openstackclient/image/v2/image.py index a2e45fc7..d793c459 100644 --- a/openstackclient/image/v2/image.py +++ b/openstackclient/image/v2/image.py @@ -749,7 +749,7 @@ class SetImage(command.Command): "--tag", dest="tags", metavar="", - default=[], + default=None, action='append', help=_("Set a tag on this image " "(repeat option to set multiple tags)"), @@ -860,7 +860,7 @@ class SetImage(command.Command): for attr in copy_attrs: if attr in parsed_args: val = getattr(parsed_args, attr, None) - if val: + if val is not None: # Only include a value in kwargs for attributes that are # actually present on the command line kwargs[attr] = val -- cgit v1.2.1