[Git][NTPsec/ntpsec][master] Attemoting fix for GitLab issue #131: pyntpq: kerninfo fails

Eric S. Raymond gitlab at mg.gitlab.com
Mon Oct 24 05:45:38 UTC 2016


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


Commits:
b6381fcc by Eric S. Raymond at 2016-10-24T01:44:41-04:00
Attemoting fix for GitLab issue #131: pyntpq: kerninfo fails

- - - - -


1 changed file:

- pylib/packet.py


Changes:

=====================================
pylib/packet.py
=====================================
--- a/pylib/packet.py
+++ b/pylib/packet.py
@@ -618,17 +618,20 @@ class Mode6Session:
         items = []
         if response:
             for pair in response.split(","):
-                eq = pair.index("=")
-                var = pair[:eq].strip()
-                val = pair[eq+1:].strip()
                 try:
-                    val = int(val, 0)
-                except ValueError:
+                    eq = pair.index("=")
+                    var = pair[:eq].strip()
+                    val = pair[eq+1:].strip()
                     try:
-                        val = float(val)
+                        val = int(val, 0)
                     except ValueError:
-                        if val[0] == '"' and val[-1] == '"':
-                            val = val[1:-1]
-                items.append((var, val))
+                        try:
+                            val = float(val)
+                        except ValueError:
+                            if val[0] == '"' and val[-1] == '"':
+                                val = val[1:-1]
+                    items.append((var, val))
+                except:
+                    sys.stderr.write("ill-formed item %s in response" % repr(pair))
         return collections.OrderedDict(items)
 # end



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/b6381fcce884807a8de8fac4100db4511ecb45e0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161024/0a9c84a0/attachment.html>


More information about the vc mailing list