[CalendarServer-changes] [7537] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Fri May 27 09:25:27 PDT 2011


Revision: 7537
          http://trac.macosforge.org/projects/calendarserver/changeset/7537
Author:   sagen at apple.com
Date:     2011-05-27 09:25:26 -0700 (Fri, 27 May 2011)
Log Message:
-----------
Allows calendarserver_monitor_notifications to be used on servers which don't advertise push-transports DAV property.

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tools/notifications.py
    CalendarServer/trunk/doc/calendarserver_monitor_notifications.8

Modified: CalendarServer/trunk/calendarserver/tools/notifications.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/notifications.py	2011-05-27 16:03:40 UTC (rev 7536)
+++ CalendarServer/trunk/calendarserver/tools/notifications.py	2011-05-27 16:25:26 UTC (rev 7537)
@@ -47,10 +47,17 @@
     print "  -f --config <path>: Specify caldavd.plist configuration path"
     print "  -h --help: print this help and exit"
     print "  -H --host <hostname>: calendar server host name"
+    print "  -n --node <pubsub node>: pubsub node to subscribe to *"
     print "  -p --port <port number>: calendar server port number"
     print "  -s --ssl: use https (default is http)"
     print "  -v --verbose: print additional information including XMPP traffic"
     print ""
+    print " * The --node option is only required for calendar servers that"
+    print "   don't advertise the push-transports DAV property (such as a Snow"
+    print "   Leopard server).  In this case, --host should specify the name"
+    print "   of the XMPP server and --port should specify the port XMPP is"
+    print "   is listening on."
+    print ""
 
     if e:
         sys.stderr.write("%s\n" % (e,))
@@ -62,11 +69,12 @@
 def main():
     try:
         (optargs, args) = getopt(
-            sys.argv[1:], "a:f:hH:p:sv", [
+            sys.argv[1:], "a:f:hH:n:p:sv", [
                 "admin=",
                 "config=",
                 "help",
                 "host=",
+                "node=",
                 "port=",
                 "ssl",
                 "verbose",
@@ -78,6 +86,7 @@
     admin = None
     configFileName = None
     host = None
+    nodes = None
     port = None
     useSSL = False
     verbose = False
@@ -91,6 +100,8 @@
             admin = arg
         elif opt in ("-H", "--host"):
             host = arg
+        elif opt in ("-n", "--node"):
+            nodes = [arg]
         elif opt in ("-p", "--port"):
             port = int(arg)
         elif opt in ("-s", "--ssl"):
@@ -126,8 +137,8 @@
         password = getpass("Password for %s: " % (username,))
         admin = username
 
-    monitorService = PushMonitorService(useSSL, host, port, admin, username,
-        password, verbose)
+    monitorService = PushMonitorService(useSSL, host, port, nodes, admin,
+        username, password, verbose)
     reactor.addSystemEventTrigger("during", "startup",
         monitorService.startService)
     reactor.addSystemEventTrigger("before", "shutdown",
@@ -305,10 +316,12 @@
     using XMPP and monitored for updates.
     """
 
-    def __init__(self, useSSL, host, port, authname, username, password, verbose):
+    def __init__(self, useSSL, host, port, nodes, authname, username, password,
+        verbose):
         self.useSSL = useSSL
         self.host = host
         self.port = port
+        self.nodes = nodes
         self.authname = authname
         self.username = username
         self.password = password
@@ -317,24 +330,31 @@
     @inlineCallbacks
     def startService(self):
         try:
-            paths = set()
-            principal = "/principals/users/%s/" % (self.username,)
-            name, homes = (yield self.getPrincipalDetails(principal))
-            if self.verbose:
-                print name, homes
-            for home in homes:
-                paths.add(home)
-            for principal in (yield self.getProxyFor()):
-                name, homes = (yield self.getPrincipalDetails(principal,
-                    includeCardDAV=False))
+            subscribeNodes = { }
+            if self.nodes is None:
+                paths = set()
+                principal = "/principals/users/%s/" % (self.username,)
+                name, homes = (yield self.getPrincipalDetails(principal))
                 if self.verbose:
                     print name, homes
                 for home in homes:
                     paths.add(home)
-            subscribeNodes = { }
-            for path in paths:
-                host, port, nodes = (yield self.getPushInfo(path))
-                subscribeNodes.update(nodes)
+                for principal in (yield self.getProxyFor()):
+                    name, homes = (yield self.getPrincipalDetails(principal,
+                        includeCardDAV=False))
+                    if self.verbose:
+                        print name, homes
+                    for home in homes:
+                        paths.add(home)
+                for path in paths:
+                    host, port, nodes = (yield self.getPushInfo(path))
+                    subscribeNodes.update(nodes)
+            else:
+                for node in self.nodes:
+                    subscribeNodes[node] = ("Unknown", "Unknown", "Unknown")
+                host = self.host
+                port = self.port
+
             if subscribeNodes:
                 self.startMonitoring(host, port, subscribeNodes)
             else:

Modified: CalendarServer/trunk/doc/calendarserver_monitor_notifications.8
===================================================================
--- CalendarServer/trunk/doc/calendarserver_monitor_notifications.8	2011-05-27 16:03:40 UTC (rev 7536)
+++ CalendarServer/trunk/doc/calendarserver_monitor_notifications.8	2011-05-27 16:25:26 UTC (rev 7537)
@@ -25,6 +25,7 @@
 .Op Fl -admin Ar username
 .Op Fl -config Ar file
 .Op Fl -host Ar hostname
+.Op Fl -node Ar pubsub-node-name
 .Op Fl -port Ar port-number
 .Op Fl -ssl
 .Op Fl -verbose
@@ -44,6 +45,8 @@
 Use the Calendar Server configuration specified in the given file.  Defaults to /etc/caldavd/caldavd.plist.
 .It Fl H, -host Ar HOSTNAME
 Connect to the specified calendar server.  If not passed on the command line, the host name is looked up in the configuration file.
+.It Fl n, -node Ar NODENAME
+Bypass the auto-discovery of pubsub nodes and specify one explicitly.  Useful on calendar servers which don't support the push-transports DAV property.  When using this option, the host and port options instead refer to the XMPP server host and port numbers.
 .It Fl p, -port Ar NUMBER
 Connect to the specified port number.  If not passed on the command line, the port number is looked up in the configuration file.
 .It Fl s, -ssl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110527/d7688b56/attachment.html>


More information about the calendarserver-changes mailing list