Possible division by zero error when pulling an image - fixes #1463
Signed-off-by: Todd Whiteman <todd.whiteman@joyent.com>
This commit is contained in:
parent
1344099e29
commit
b9c502531d
2 changed files with 21 additions and 2 deletions
|
|
@ -74,8 +74,9 @@ def print_output_event(event, stream, is_terminal):
|
|||
stream.write("%s %s%s" % (status, event['progress'], terminator))
|
||||
elif 'progressDetail' in event:
|
||||
detail = event['progressDetail']
|
||||
if 'current' in detail:
|
||||
percentage = float(detail['current']) / float(detail['total']) * 100
|
||||
total = detail.get('total')
|
||||
if 'current' in detail and total:
|
||||
percentage = float(detail['current']) / float(total) * 100
|
||||
stream.write('%s (%.1f%%)%s' % (status, percentage, terminator))
|
||||
else:
|
||||
stream.write('%s%s' % (status, terminator))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue