[Git][NTPsec/ntpsec][master] 2 commits: Remove some test code no longer needed.

Eric S. Raymond gitlab at mg.gitlab.com
Wed Oct 19 01:37:24 UTC 2016


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


Commits:
e412849f by Eric S. Raymond at 2016-10-18T20:52:09-04:00
Remove some test code no longer needed.

- - - - -
680e2496 by Eric S. Raymond at 2016-10-18T21:36:29-04:00
Typo fixes annd minor refactoring.  Make attribute dictionaries ordered.

- - - - -


2 changed files:

- ntpq/pyntpq
- pylib/packet.py


Changes:

=====================================
ntpq/pyntpq
=====================================
--- a/ntpq/pyntpq
+++ b/ntpq/pyntpq
@@ -284,7 +284,6 @@ usage: help [ command ]
     def __dogetassoc(self):
         try:
             self.peers = self.session.readstat()
-            self.peers.sort(key=lambda a: a.associd)
         except Mode6Exception as e:
             print(e.message)
             return False
@@ -303,7 +302,7 @@ usage: help [ command ]
     def __printassoc(self, showall):
 	condition = "";
         if not self.peers:
-            sys.stdout.write("No association ID's in list\n");
+            sys.stdout.write("No association IDs in list\n");
             return;
 	sys.stdout.write("\nind assid status  conf reach auth condition  last_event cnt\n");
         sys.stdout.write("===========================================================\n");
@@ -467,7 +466,7 @@ usage: timeout [ msec ]
             elif fmt in (NTP_2BIT, NTP_MODE):
                 sys.stdout.write("%s %s\n" % (legend, bin(value)[2:]))
             else:
-                sys.stderr.write("unxpected vc type %s for %s, value %s\n" % (fmt, name, value))
+                sys.stderr.write("unexpected vc type %s for %s, value %s\n" % (fmt, name, value))
 
     def do_delay(self, line):
         "set the delay added to encryption time stamps"
@@ -686,7 +685,6 @@ usage: ntpversion [ version number ]
     def do_keytype(self, line):
         "set key type to use for authenticated requests"
         sys.stderr.write("Authentication is not yet implemented")
-        pass
 
     def help_keytype(self):
         sys.stdout.write("""\
@@ -695,23 +693,6 @@ function: set key type to use for authenticated requests, one of:
 usage: keytype [ digest-name ]
 """)
 
-    def do_exercise(self, line):
-        "Exercise the protocol - low level"
-        tokens = shlex.split(line)
-        if len(tokens) == 0:
-            print("Requires an opcode, followed by optional associd and payload string")
-            return
-        elif len(tokens) == 1:
-            tokens.append(0)
-            tokens.append("")
-        elif len(tokens) == 2:
-            tokens.append("")
-        msg = self.session.doquery(int(tokens[0]),
-                                   int(tokens[1]),
-                                   polybytes(tokens[2]))
-        if msg:
-            print(msg)
-
     def do_associations(self, line):
         "print list of association IDs and statuses for the server's peers"
         if self.__dogetassoc():
@@ -719,7 +700,7 @@ usage: keytype [ digest-name ]
 
     def help_associations(self):
         sys.stdout.write("""\
-function: print list of association ID's and statuses for the server's peers
+function: print list of association IDs and statuses for the server's peers
 usage: associations
 """)
 


=====================================
pylib/packet.py
=====================================
--- a/pylib/packet.py
+++ b/pylib/packet.py
@@ -5,7 +5,7 @@
 #
 # SPDX-License-Identifier: BSD-2-clause
 from __future__ import print_function, division
-import sys, socket, select, struct, curses.ascii
+import sys, socket, select, struct, curses.ascii, collections
 
 from ntp_control import *
 
@@ -568,6 +568,7 @@ class Mode6Session:
                 data = self.response[4*i:4*i+4]
                 (associd, status) = struct.unpack("!HH", data)
                 idlist.append(Peer(self, associd, status))
+        idlist.sort(key=lambda a: a.associd)
         return idlist
 
     def readvar(self, associd=0, varlist=None):
@@ -597,5 +598,5 @@ class Mode6Session:
                         if val[0] == '"' and val[-1] == '"':
                             val = val[1:-1]
                 items.append((var, val))
-        return dict(items)
+        return collections.OrderedDict(items)
 # end



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/d69e85d80d0eabd56d1f7c6aadb975a020ea8f60...680e24967f88da7ec9a45e07316b53d20f101c87
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161019/2169f53a/attachment.html>


More information about the vc mailing list