[CalendarServer-changes] [13776] CalendarServer/trunk/calendarserver/tools/dashboard.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Jul 18 11:23:07 PDT 2014


Revision: 13776
          http://trac.calendarserver.org//changeset/13776
Author:   cdaboo at apple.com
Date:     2014-07-18 11:23:07 -0700 (Fri, 18 Jul 2014)
Log Message:
-----------
Allow the server host:port to be specified.

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tools/dashboard.py

Modified: CalendarServer/trunk/calendarserver/tools/dashboard.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/dashboard.py	2014-07-17 21:54:34 UTC (rev 13775)
+++ CalendarServer/trunk/calendarserver/tools/dashboard.py	2014-07-18 18:23:07 UTC (rev 13776)
@@ -41,6 +41,7 @@
     print("options:")
     print("  -h --help: print this help and exit")
     print("  -t: text output, not curses")
+    print("  -s: server host (and optional port) [localhost:8100]")
     print("")
 
     if e:
@@ -55,7 +56,7 @@
 def main():
     try:
         (optargs, _ignore_args) = getopt(
-            sys.argv[1:], "ht", [
+            sys.argv[1:], "hs:t", [
                 "help",
             ],
         )
@@ -66,14 +67,23 @@
     # Get configuration
     #
     useCurses = True
+    server = ("localhost", 8100)
 
-    for opt, _ignore_arg in optargs:
+    for opt, arg in optargs:
         if opt in ("-h", "--help"):
             usage()
 
         elif opt in ("-t"):
             useCurses = False
 
+        elif opt in ("-s"):
+            server = arg.split(":")
+            if len(server) == 1:
+                server.append(8100)
+            else:
+                server[1] = int(server[1])
+            server = tuple(server)
+
         else:
             raise NotImplementedError(opt)
 
@@ -82,7 +92,7 @@
             curses.curs_set(0)
             curses.use_default_colors()
             curses.init_pair(1, curses.COLOR_RED, curses.COLOR_WHITE)
-            d = Dashboard(stdscrn, True)
+            d = Dashboard(server, stdscrn, True)
             d.run()
         curses.wrapper(_wrapped)
     else:
@@ -111,13 +121,13 @@
     registered_windows = {}
     registered_order = []
 
-    def __init__(self, screen, usesCurses):
+    def __init__(self, server, screen, usesCurses):
         self.screen = screen
         self.usesCurses = usesCurses
         self.paused = False
         self.seconds = 0.1 if usesCurses else 1.0
         self.sched = sched.scheduler(time.time, time.sleep)
-        self.client = DashboardClient(("localhost", 8100), True)
+        self.client = DashboardClient(server, True)
         self.client_error = False
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140718/12781136/attachment.html>


More information about the calendarserver-changes mailing list