[CalendarServer-changes] [2110] CalendarServer/trunk/twistedcaldav/cluster.py

source_changes at macosforge.org source_changes at macosforge.org
Mon Jan 21 11:26:03 PST 2008


Revision: 2110
          http://trac.macosforge.org/projects/calendarserver/changeset/2110
Author:   dreid at apple.com
Date:     2008-01-21 11:26:00 -0800 (Mon, 21 Jan 2008)

Log Message:
-----------
Make 0 actually disable HTTP instead of raise an error, also add some ConfigurationErrors that clearly indicate when things have gone really wrong and we just basically can't start up at all.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/cluster.py

Modified: CalendarServer/trunk/twistedcaldav/cluster.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/cluster.py	2008-01-11 22:00:19 UTC (rev 2109)
+++ CalendarServer/trunk/twistedcaldav/cluster.py	2008-01-21 19:26:00 UTC (rev 2110)
@@ -24,7 +24,7 @@
 from twisted.application import internet, service
 
 from twistedcaldav import logging
-from twistedcaldav.config import config
+from twistedcaldav.config import config, ConfigurationError
 
 from twistedcaldav.util import getNCPU
 
@@ -67,10 +67,13 @@
         self.interfaces = interfaces
 
     def getName(self):
-        return '%s-%s' % (self.prefix, self.ports[0])
+        if self.ports is not None:
+            return '%s-%s' % (self.prefix, self.ports[0])
+        elif self.sslPorts is not None:
+            return '%s-%s' % (self.prefix, self.sslPorts[0])
 
-    def getSSLName(self):
-        return '%s-%s' % (self.prefix, self.sslPorts[0])
+        raise ConfigurationError(
+            "Can't create TwistdSlaveProcess without a TCP Port")
 
     def getCommandLine(self):
         args = [
@@ -100,7 +103,7 @@
 
         if self.sslPorts:
             args.extend([
-                    '-o', 
+                    '-o',
                     'BindSSLPorts=%s' % (','.join(map(str, self.sslPorts)),)])
 
 
@@ -108,18 +111,25 @@
 
         return args
 
-    def getHostLine(self, ssl=None):
+    def getHostLine(self, ssl=True):
         name = self.getName()
-        port = self.ports
+        port = None
 
-        if ssl:
-            name = self.getSSLName()
+        if self.ports is not None:
+            port = self.ports
+
+        if ssl and self.sslPorts is not None:
             port = self.sslPorts
 
+        if port is None:
+            raise ConfigurationError(
+                "Can not add a host without a port")
+
         return hostTemplate % {'name': name,
                                'port': port[0],
                                'bindAddress': '127.0.0.1'}
 
+
 def makeService_Combined(self, options):
     s = service.MultiService()
     monitor = procmon.ProcessMonitor()

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080121/2c49502b/attachment.html


More information about the calendarserver-changes mailing list