From bafece762a5d0b03e28f9d81c98ad46777f56a34 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Fri, 21 Oct 2022 16:40:36 +0100 Subject: image: Ignore '--progress' if providing image data from stdin You can provide data via stdin when creating an image. Using this with '--progress' makes no sense and causes an error currently. Fix this. Change-Id: I3c2d658b72a7c62931b779b0d19bb97f60a0c655 Signed-off-by: Stephen Finucane --- openstackclient/image/v2/image.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'openstackclient/image') diff --git a/openstackclient/image/v2/image.py b/openstackclient/image/v2/image.py index 2342fd3e..1ff8ad3a 100644 --- a/openstackclient/image/v2/image.py +++ b/openstackclient/image/v2/image.py @@ -476,7 +476,9 @@ class CreateImage(command.ShowOne): LOG.warning(_("Failed to get an image file.")) return {}, {} - if fp is not None and parsed_args.progress: + if parsed_args.progress and parsed_args.file: + # NOTE(stephenfin): we only show a progress bar if the user + # requested it *and* we're reading from a file (not stdin) filesize = os.path.getsize(fname) if filesize is not None: kwargs['validate_checksum'] = False -- cgit v1.2.1