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