Handle empty ping response
This commit is contained in:
parent
3b4bb51925
commit
b24ddf7546
|
@ -14,7 +14,12 @@ def retrieve_state(servers):
|
|||
state = {}
|
||||
for server, ping, uptime in zip(servers, pings, uptimes):
|
||||
ping = join(ping, silent=True)
|
||||
ping = ping.stdout.splitlines()[-1].decode()
|
||||
|
||||
try:
|
||||
ping = ping.stdout.splitlines()[-1].decode()
|
||||
except IndexError:
|
||||
ping = ''
|
||||
|
||||
if ping.startswith('rtt'):
|
||||
ping = '%s ms' % ping.split('/')[4]
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue