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
This commit is contained in:
Jon Bernard 2014-01-31 13:54:44 -05:00
parent 238e9fffcc
commit 0934b97897
1 changed files with 2 additions and 1 deletions

View File

@ -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