From b24ddf75464fe0e634734e4350fd23097ea1361a Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Mon, 17 May 2021 13:22:08 +0200 Subject: [PATCH] Handle empty ping response --- orchestra/contrib/orchestration/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/orchestra/contrib/orchestration/utils.py b/orchestra/contrib/orchestration/utils.py index 9e4dd51d..df59f8c9 100644 --- a/orchestra/contrib/orchestration/utils.py +++ b/orchestra/contrib/orchestration/utils.py @@ -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: