[Git][NTPsec/ntpsec][master] 3 commits: Fix typo in comment
Eric S. Raymond
gitlab at mg.gitlab.com
Sat Dec 3 18:18:55 UTC 2016
Eric S. Raymond pushed to branch master at NTPsec / ntpsec
Commits:
552339cf by Matt Selsky at 2016-12-03T10:29:03-05:00
Fix typo in comment
- - - - -
ccd1caac by Matt Selsky at 2016-12-03T10:44:41-05:00
Fix function name in ntpsweep
NameError: name 'ntp_peers' is not defined
- - - - -
7bc50025 by Matt Selsky at 2016-12-03T10:45:53-05:00
file.readlines() is a function, not an attributes
TypeError: 'builtin_function_or_method' object is not subscriptable
- - - - -
3 changed files:
- ntpq/ntpq
- ntpsweep/ntpsweep
- pylib/util.py
Changes:
=====================================
ntpq/ntpq
=====================================
--- a/ntpq/ntpq
+++ b/ntpq/ntpq
@@ -348,6 +348,8 @@ usage: help [ command ]
if not self.__dogetassoc():
return
if self.showhostnames:
+ print("HELLO")
+ print(ntp.util.termsize())
termwidth = ntp.util.termsize().width
else:
termwidth = None # Default width
=====================================
ntpsweep/ntpsweep
=====================================
--- a/ntpsweep/ntpsweep
+++ b/ntpsweep/ntpsweep
@@ -25,11 +25,11 @@ from __future__ import print_function
import os, sys, getopt
import ntp.packet, ntp.util
-def peers(host):
- "Return a list of peer IP addrs for a specified host, None if query failed."
+def ntp_peers(host):
+ "Return a list of peer IP addrs for a specified host, empty list if query failed."
try:
with os.popen("ntpq -npw " + host) as rp:
- hostlines = rp.readlines[2:] # Drop display header
+ hostlines = rp.readlines()[2:] # Drop display header
# Strip tally mark from first field
return [ln.split()[0][1:] for ln in hostlines if ln[0] in " x.-+#*o"]
except OSError:
=====================================
pylib/util.py
=====================================
--- a/pylib/util.py
+++ b/pylib/util.py
@@ -69,7 +69,7 @@ TermSize = collections.namedtuple("TermSize", ["width", "height"])
def termsize():
"Return the current terminal size."
# Alternatives at http://stackoverflow.com/questions/566746/how-to-get-console-window-width-in-python
- # The way this is usedd makes it not a big deal if the default is wrong.
+ # The way this is used makes it not a big deal if the default is wrong.
size = (80, 24)
if os.isatty(1):
try:
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/2356444f7deccf0a5af20f54d3da82fc819f2981...7bc500258392d796b9d0266ddaf7516d1beb5a61
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161203/e3cec299/attachment.html>
More information about the vc
mailing list