[Git][NTPsec/ntpsec][master] ntpviz: be consistent on --name usage. remove title file

Gary E. Miller gitlab at mg.gitlab.com
Thu Oct 6 00:00:44 UTC 2016


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


Commits:
f5a1eb98 by Gary E. Miller at 2016-10-05T16:59:22-07:00
ntpviz: be consistent on --name usage.  remove title file

Now that @optionfile works, no need for title file.

- - - - -


2 changed files:

- docs/includes/ntpviz-body.txt
- ntpstats/ntpviz


Changes:

=====================================
docs/includes/ntpviz-body.txt
=====================================
--- a/docs/includes/ntpviz-body.txt
+++ b/docs/includes/ntpviz-body.txt
@@ -117,7 +117,7 @@ named 'ntpgraphs', but the name can be changed with the -o option.
 Warning: existing PNG files and index.html in this directory will be
 clobbered.
 
-When an index is generated, ntpviz will look for three files in the
+When an index is generated, ntpviz will look for two files in the
 output directory.  None of the files need be present, and the
 'header' and 'footer' files may contain arbitrary html.
 contain aribtrary HTML.
@@ -133,9 +133,6 @@ added almost at the bottom of the body on the generated index.
 It is suggested that notes on the server be included in the footer
 file: OS, versions, CPU speed, etc.  You may also put links there.
 
-The third file is named 'title' and must be a single line of text.  This
-text will be used as the HTML title of the generated index.
-
 The code includes various sanity checks and will bail out with a message to
 standard error on, for example, missing logfile data required for a plot.
 


=====================================
ntpstats/ntpviz
=====================================
--- a/ntpstats/ntpviz
+++ b/ntpstats/ntpviz
@@ -1001,11 +1001,6 @@ Python by ESR, concept and GNUPLOT code by Dan Drown.
             sys.stderr.write("ntpviz: INFO: now running at nice: %s\n" % \
                 nice)
 
-    statlist = [NTPViz(statsdir=d, sitename=args.sitename,
-                        period=args.period, starttime=args.starttime,
-                        endtime=args.endtime)
-                for d in args.statsdirs]
-
     for fontpath in ("/usr/share/fonts/liberation",
                      "/usr/share/fonts/liberation-fonts",
                      "/usr/share/fonts/truetype/liberation"):
@@ -1019,6 +1014,16 @@ Python by ESR, concept and GNUPLOT code by Dan Drown.
 
     plot = None
 
+    if 1 == len(args.statsdirs):
+        statlist = [NTPViz(statsdir=args.statsdirs[0], sitename=args.sitename,
+                        period=args.period, starttime=args.starttime,
+                        endtime=args.endtime)]
+    else:
+        statlist = [NTPViz(statsdir=d, sitename=d,
+                        period=args.period, starttime=args.starttime,
+                        endtime=args.endtime)
+                for d in args.statsdirs]
+
     if len(statlist) == 1:
         stats = statlist[0]
 
@@ -1099,15 +1104,7 @@ Python by ESR, concept and GNUPLOT code by Dan Drown.
     start_time = datetime.datetime.utcnow()
     start_time_str = start_time.strftime("%c")
 
-    # if title file, get title from it
-    title_f = os.path.join(args.outdir, "title")
-    title = 'ntpviz'
-    if os.path.isfile(title_f):
-        try:
-            title_file = open( title_f, 'r')
-            title = title_file.read()
-        except IOError:
-            pass
+    title = args.sitename
 
     index_header = '''\
 <!DOCTYPE html>



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


More information about the vc mailing list