diff --git a/glanceclient/v1/shell.py b/glanceclient/v1/shell.py index e2171e7..9540a95 100644 --- a/glanceclient/v1/shell.py +++ b/glanceclient/v1/shell.py @@ -234,9 +234,12 @@ def do_image_create(gc, args): # Only show progress bar for local image files if fields.get('data') and args.progress: filesize = utils.get_file_size(fields['data']) - fields['data'] = progressbar.VerboseFileWrapper( - fields['data'], filesize - ) + if filesize is not None: + # NOTE(kragniz): do not show a progress bar if the size of the + # input is unknown (most likely a piped input) + fields['data'] = progressbar.VerboseFileWrapper( + fields['data'], filesize + ) image = gc.images.create(**fields) _image_show(image, args.human_readable) diff --git a/glanceclient/v2/shell.py b/glanceclient/v2/shell.py index a49d291..fa69f1d 100644 --- a/glanceclient/v2/shell.py +++ b/glanceclient/v2/shell.py @@ -258,7 +258,10 @@ def do_image_upload(gc, args): image_data = utils.get_data_file(args) if args.progress: filesize = utils.get_file_size(image_data) - image_data = progressbar.VerboseFileWrapper(image_data, filesize) + if filesize is not None: + # NOTE(kragniz): do not show a progress bar if the size of the + # input is unknown (most likely a piped input) + image_data = progressbar.VerboseFileWrapper(image_data, filesize) gc.images.upload(args.id, image_data, args.size)