Add try/except around new log lines

Fixes #73
This commit is contained in:
Joshua Boniface 2020-01-30 09:28:47 -05:00
parent ebfd9c1882
commit 4868625809
1 changed files with 5 additions and 2 deletions

View File

@ -289,8 +289,11 @@ def follow_console_log(config, vm, lines=10):
while True:
# Grab the next line set
response = call_api(config, 'get', '/vm/{vm}/console'.format(vm=vm), params=params)
new_console_log = response.json()['data']
try:
response = call_api(config, 'get', '/vm/{vm}/console'.format(vm=vm), params=params)
new_console_log = response.json()['data']
except:
break
# Split the new and old log strings into constitutent lines
old_console_loglines = console_log.split('\n')
new_console_loglines = new_console_log.split('\n')