[Git][NTPsec/ntpsec][master] Workaround GitLab issue #210: detail mode on remote host crashes ntpmon

Eric S. Raymond gitlab at mg.gitlab.com
Thu Dec 22 20:23:49 UTC 2016


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
f4fd9091 by Eric S. Raymond at 2016-12-22T15:23:34-05:00
Workaround GitLab issue #210: detail mode on remote host crashes ntpmon

- - - - -


1 changed file:

- ntpclients/ntpmon


Changes:

=====================================
ntpclients/ntpmon
=====================================
--- a/ntpclients/ntpmon
+++ b/ntpclients/ntpmon
@@ -70,9 +70,11 @@ def peer_detail(variables):
     vcopy = {}
     vcopy.update(variables)
     vcopy["leap"] = ("no-leap", "add-leap", "del-leap", "unsync")[vcopy["leap"]]
-    vcopy['xmt'] = ntp.util.rfc3339(ntp.ntpc.lfptofloat(vcopy['xmt']))
-    vcopy['rec'] = ntp.util.rfc3339(ntp.ntpc.lfptofloat(vcopy['rec']))
-    vcopy['reftime'] = ntp.util.rfc3339(ntp.ntpc.lfptofloat(vcopy['reftime']))
+    for fld in ('xmt', 'rec', 'reftime'):
+        if fld not in vcopy:
+            vcopy[fld] = "***missing***"
+        else:
+            vcopy[fld] = ntp.util.rfc3339(ntp.ntpc.lfptofloat(vcopy[fld]))
     vcopy['filtdelay'] = vcopy['filtdelay'].replace(' ', '\t')
     vcopy['filtoffset'] = vcopy['filtoffset'].replace(' ', '\t')
     vcopy['filtdisp'] = vcopy['filtdisp'].replace(' ', '\t')



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/f4fd90915f8e61bf1cb2039df2160d36c0ed0b92
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20161222/5faa3e34/attachment.html>


More information about the vc mailing list