summaryrefslogtreecommitdiff
path: root/glanceclient/v1/shell.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-02-04 23:41:11 +0000
committerGerrit Code Review <review@openstack.org>2015-02-04 23:41:11 +0000
commit5b2603d74ebad1147ac5bfd9bf18d470fe127716 (patch)
treec2db8f392dee7f87a8a70d1a25bad0d1c3d30afc /glanceclient/v1/shell.py
parent9a78cb24714258bbb03302c1ac38931dd310c9ff (diff)
parent90543244423692cade8673cf78fa601c9af04f1c (diff)
downloadpython-glanceclient-5b2603d74ebad1147ac5bfd9bf18d470fe127716.tar.gz
Merge "Disable progress bar if image is piped into client"
Diffstat (limited to 'glanceclient/v1/shell.py')
-rw-r--r--glanceclient/v1/shell.py9
1 files changed, 6 insertions, 3 deletions
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)