[Git][NTPsec/ntpsec][master] 5 commits: ntpviz: a stab at issue #16, maybe line coninuation changed in 2.7?

Gary E. Miller gitlab at mg.gitlab.com
Wed Jan 4 03:56:19 UTC 2017


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
55c2e5d3 by Gary E. Miller at 2017-01-03T18:44:13-08:00
ntpviz: a stab at issue #16, maybe line coninuation changed in 2.7?

- - - - -
8734991b by Gary E. Miller at 2017-01-03T19:08:07-08:00
ntptrace: partial fix for issue #16

use subprocess.Popen() instead of subprocess.check_output()

- - - - -
10fe4db8 by Gary E. Miller at 2017-01-03T19:17:12-08:00
cpu-temp-log: partial fix for issue #16

- - - - -
f885da89 by Gary E. Miller at 2017-01-03T19:22:31-08:00
smartctl-temp-log: partial fix for issue #16

- - - - -
62b0967f by Gary E. Miller at 2017-01-03T19:51:20-08:00
temper-temp-log: partial fix for issue #16

- - - - -


5 changed files:

- contrib/cpu-temp-log
- contrib/smartctl-temp-log
- contrib/temper-temp-log
- ntpclients/ntptrace
- ntpclients/ntpviz


Changes:

=====================================
contrib/cpu-temp-log
=====================================
--- a/contrib/cpu-temp-log
+++ b/contrib/cpu-temp-log
@@ -43,8 +43,12 @@ import time
 import subprocess
 
 try:
-    output = subprocess.check_output(["sensors", "-u"],
-                                     universal_newlines=True)
+    # sadly subprocess.check_output() is not in Python 2.6
+    proc = subprocess.Popen(["sensors", "-u"],
+                            stdout=subprocess.PIPE,
+                            stderr=subprocess.STDOUT,
+                            universal_newlines=True)
+    output = proc.communicate()[0]
 except:
     print("Unable to run 'sensors -u'")
     exit(0)


=====================================
contrib/smartctl-temp-log
=====================================
--- a/contrib/smartctl-temp-log
+++ b/contrib/smartctl-temp-log
@@ -50,9 +50,12 @@ if 1 < len(sys.argv):
     device = sys.argv[1]
 
 try:
-    output = subprocess.check_output(["smartctl", "-a", device],
-                                     stderr=subprocess.STDOUT,
-                                     universal_newlines=True)
+    # sadly subprocess.check_output() is not in Python 2.6
+    proc = subprocess.Popen(["smartctl", "-a", device],
+                            stdout=subprocess.PIPE,
+                            stderr=subprocess.STDOUT,
+                            universal_newlines=True)
+    output = proc.communicate()[0]
 
 except subprocess.CalledProcessError as e:
     sys.stderr.write("ERROR: 'smartctl -a %s' failed\n" % device)


=====================================
contrib/temper-temp-log
=====================================
--- a/contrib/temper-temp-log
+++ b/contrib/temper-temp-log
@@ -33,8 +33,12 @@ from __future__ import print_function
 import time
 import subprocess
 
-output = subprocess.check_output(["temper-poll", "-c"],
-                                 universal_newlines=True)
+# sadly subprocess.check_output() is not in Python 2.6
+proc = subprocess.Popen(["temper-poll", "-c"],
+                        stdout=subprocess.PIPE,
+                        stderr=subprocess.STDOUT,
+                        universal_newlines=True)
+output = proc.communicate()[0]
 
 now = int(time.time())
 


=====================================
ntpclients/ntptrace
=====================================
--- a/ntpclients/ntptrace
+++ b/ntpclients/ntptrace
@@ -56,9 +56,13 @@ def ntp_read_vars(peer, vars, host):
         cmd.append(host)
 
     try:
-        output = subprocess.check_output(
+        # sadly subprocess.check_output() is not in Python 2.6
+        proc = subprocess.Popen(
             cmd,
-            stderr=subprocess.STDOUT).decode('utf-8').splitlines()
+            stdout=subprocess.PIPE,
+            stderr=subprocess.STDOUT)
+        out = proc.communicate()[0]
+        output = out.decode('utf-8').splitlines()
     except subprocess.CalledProcessError as e:
         print("Could not start ntpq: %s" % e.output, file=sys.stderr)
         raise SystemExit(1)


=====================================
ntpclients/ntpviz
=====================================
--- a/ntpclients/ntpviz
+++ b/ntpclients/ntpviz
@@ -227,8 +227,9 @@ class VizStats(ntp.statfiles.NTPStats):
         self.percs["pstd"] = pstdev(values, mu=self.percs["mu"])
 
         # range the data
-        self.percs.update({k: v * self.multiplier
-                           for k, v in list(self.percs.items())})
+        self.percs.update(
+            {k: v * self.multiplier for k, v in list(self.percs.items())}
+        )
 
         self.title = title
 



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/9fb75dcc388667294c7919dfed83d57da95ec75a...62b0967f87cffd4840635966440107d3d9f1d523
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170104/b5d24729/attachment.html>


More information about the vc mailing list