Commit 09612736 authored by Rafael Monnerat's avatar Rafael Monnerat

networkbench: Don't raise if network is unreachable

  Also don't interrupt of parse command output fails
parent a5d9a5ce
......@@ -55,7 +55,12 @@ def _test_ping(host, timeout=10, protocol="4"):
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = proc.communicate()
packet_loss_line, summary_line = (out.splitlines() or [''])[-2:]
if 'Network is unreachable' in err:
return (test_title, host, '600', 'failed', 100, "Network is unreachable")
try:
packet_loss_line, summary_line = (out.splitlines() or [''])[-2:]
except:
return (test_title, host, '600', 'failed', -1, "Fail to parser ping output")
m = ping_re.match(summary_line)
match = re.search('(\d*)% packet loss', packet_loss_line)
packet_lost_ratio = match.group(1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment