[Git][NTPsec/ntpsec][master] ntpviz: ignore corrupted log lines
Gary E. Miller
gitlab at mg.gitlab.com
Thu Oct 27 20:38:35 UTC 2016
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
ed688cdc by Gary E. Miller at 2016-10-27T13:37:36-07:00
ntpviz: ignore corrupted log lines
- - - - -
1 changed file:
- pylib/statfiles.py
Changes:
=====================================
pylib/statfiles.py
=====================================
--- a/pylib/statfiles.py
+++ b/pylib/statfiles.py
@@ -141,30 +141,42 @@ class NTPStats:
return self.peermap
for row in self.peerstats:
- ip = row[2] # peerstats field 2, refclock id
- if ip not in self.peermap:
- self.peermap[ip] = []
- self.peermap[ip].append(row)
+ try:
+ ip = row[2] # peerstats field 2, refclock id
+ if ip not in self.peermap:
+ self.peermap[ip] = []
+ self.peermap[ip].append(row)
+ except IndexError:
+ # ignore corrupted rows
+ pass
return self.peermap
def gpssplit(self):
"Return a dictionary mapping gps sources to entry subsets."
gpsmap = {}
for row in self.gpsd:
- source = row[2]
- if source not in gpsmap:
- gpsmap[source] = []
- gpsmap[source].append(row)
+ try:
+ source = row[2]
+ if source not in gpsmap:
+ gpsmap[source] = []
+ gpsmap[source].append(row)
+ except IndexError:
+ # ignore corrupted rows
+ pass
return gpsmap
def tempssplit(self):
"Return a dictionary mapping temperature sources to entry subsets."
tempsmap = {}
for row in self.temps:
- source = row[2]
- if source not in tempsmap:
- tempsmap[source] = []
- tempsmap[source].append(row)
+ try:
+ source = row[2]
+ if source not in tempsmap:
+ tempsmap[source] = []
+ tempsmap[source].append(row)
+ except IndexError:
+ # ignore corrupted rows
+ pass
return tempsmap
def ip_label(self, key):
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/ed688cdc8f104cffd1e93ad261af8baa9852f2e3
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161027/d287a72d/attachment.html>
More information about the vc
mailing list