Cross check host part and key in mtr output
Changed:
Currently code checks first chars (up to 28) of the hostname to find
the line for the host in the output. mtr cuts domain name, so check
both ways.
Tested: Ran against BMC and made sure it found the line.
Change-Id: Ia8ab7ee7769750bd4b87c990e778e9ba68444f38
Signed-off-by: Igor Kanyuka <ifelmail@gmail.com>
diff --git a/lib/utilities.py b/lib/utilities.py
index 3c54441..8e6ddc5 100755
--- a/lib/utilities.py
+++ b/lib/utilities.py
@@ -262,7 +262,13 @@
report = get_mtr_report(host)
# The max length of host in output is 28 chars.
- row = [value for key, value in report.items() if host[0:28] in key][0]
+ host_part = host[:28]
+
+ row = [
+ value
+ for key, value in report.items()
+ if key in host or host_part in key
+ ][0]
return row