From 0934b978979ddc83bc3d286455abaf91f23bc5fc Mon Sep 17 00:00:00 2001 From: Jon Bernard Date: Fri, 31 Jan 2014 13:54:44 -0500 Subject: [PATCH] Only show progress bar for local image files This patch fixes a bug where both 'location' and 'progress' are passed as command line arguments. In this case, the 'data' field is not present in the fields dict and therefore the progress option cannot be used. A check is added to make sure the user has specified both a local image file and the progress flag together. Change-Id: Ia563139ee8b56d54d480534986e4b619a503fbfc Closes-Bug: #1259357 --- glanceclient/v1/shell.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/glanceclient/v1/shell.py b/glanceclient/v1/shell.py index 0c685f84..81decab0 100644 --- a/glanceclient/v1/shell.py +++ b/glanceclient/v1/shell.py @@ -228,7 +228,8 @@ def do_image_create(gc, args): _set_data_field(fields, args) - if args.progress: + # 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