summaryrefslogtreecommitdiff
path: root/openstackclient/image/v1
diff options
context:
space:
mode:
authorShogoAdachi <sho-adachi@xc.jp.nec.com>2017-09-07 19:10:24 +0900
committerDean Troyer <dtroyer@gmail.com>2017-10-20 19:48:37 +0000
commit4464109c7754a9287f75ec2af84398700d1450e6 (patch)
treeb82fe5816ae426b8a4c52e2aa1b1141b8a4d70b2 /openstackclient/image/v1
parentde2af66c1622115dcb28aca88aa62ce5b177c771 (diff)
downloadpython-openstackclient-4464109c7754a9287f75ec2af84398700d1450e6.tar.gz
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
Diffstat (limited to 'openstackclient/image/v1')
-rw-r--r--openstackclient/image/v1/image.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/openstackclient/image/v1/image.py b/openstackclient/image/v1/image.py
index b92da8ce..7a8e67bf 100644
--- a/openstackclient/image/v1/image.py
+++ b/openstackclient/image/v1/image.py
@@ -625,11 +625,11 @@ class SetImage(command.Command):
kwargs = {}
copy_attrs = ('name', 'owner', 'min_disk', 'min_ram', 'properties',
'container_format', 'disk_format', 'size', 'store',
- 'location', 'copy_from', 'volume', 'force', 'checksum')
+ 'location', 'copy_from', 'volume', 'checksum')
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
@@ -653,6 +653,8 @@ class SetImage(command.Command):
kwargs['is_public'] = True
if parsed_args.private:
kwargs['is_public'] = False
+ if parsed_args.force:
+ kwargs['force'] = True
# Wrap the call to catch exceptions in order to close files
try: