[CalendarServer-changes] [8933] CalendarServer/branches/users/wsanchez/d2

source_changes at macosforge.org source_changes at macosforge.org
Tue Mar 27 12:21:07 PDT 2012


Revision: 8933
          http://trac.macosforge.org/projects/calendarserver/changeset/8933
Author:   sagen at apple.com
Date:     2012-03-27 12:21:07 -0700 (Tue, 27 Mar 2012)
Log Message:
-----------
Bring manhole access over from trunk

Modified Paths:
--------------
    CalendarServer/branches/users/wsanchez/d2/calendarserver/tap/caldav.py
    CalendarServer/branches/users/wsanchez/d2/twistedcaldav/stdconfig.py

Modified: CalendarServer/branches/users/wsanchez/d2/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/branches/users/wsanchez/d2/calendarserver/tap/caldav.py	2012-03-27 19:16:29 UTC (rev 8932)
+++ CalendarServer/branches/users/wsanchez/d2/calendarserver/tap/caldav.py	2012-03-27 19:21:07 UTC (rev 8933)
@@ -50,6 +50,8 @@
 from twisted.application.service import MultiService, IServiceMaker
 from twisted.application.service import Service
 
+from twisted.conch.manhole_tap import makeService as manholeMakeService
+
 import twext
 from twext.web2.server import Site
 from twext.python.log import Logger, LoggingMixIn
@@ -650,6 +652,25 @@
         result = self.requestProcessingService(options, store)
         if pool is not None:
             pool.setServiceParent(result)
+
+        # Optionally enable Manhole access
+        if config.Manhole.Enabled:
+            portString = "tcp:%d:interface=127.0.0.1" % (config.Manhole.StartingPortNumber + int(config.LogID) + 1,)
+            manholeService = manholeMakeService({
+                "sshPort" : None,
+                "telnetPort" : portString,
+                "namespace" : {
+                    "config" : config,
+                    "service" : result,
+                    "store" : store,
+                    "directory" : result.rootResource.getDirectory(),
+                    },
+                "passwd" : config.Manhole.PasswordFilePath,
+            })
+            manholeService.setServiceParent(result)
+            # Using print because logging isn't ready at this point
+            print "Manhole access enabled: %s" % (portString,)
+
         return result
 
 
@@ -1116,6 +1137,22 @@
         statsService.setName("stats")
         statsService.setServiceParent(s)
 
+        # Optionally enable Manhole access
+        if config.Manhole.Enabled:
+            portString = "tcp:%d:interface=127.0.0.1" % (config.Manhole.StartingPortNumber,)
+            manholeService = manholeMakeService({
+                "sshPort" : None,
+                "telnetPort" : portString,
+                "namespace" : {
+                    "config" : config,
+                    "service" : s,
+                    },
+                "passwd" : config.Manhole.PasswordFilePath,
+            })
+            manholeService.setServiceParent(s)
+            # Using print because logging isn't ready at this point
+            print "Manhole access enabled: %s" % (portString,)
+
         # Finally, let's get the real show on the road.  Create a service that
         # will spawn all of our worker processes when started, and wrap that
         # service in zero to two necessary layers before it's started: first,

Modified: CalendarServer/branches/users/wsanchez/d2/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/branches/users/wsanchez/d2/twistedcaldav/stdconfig.py	2012-03-27 19:16:29 UTC (rev 8932)
+++ CalendarServer/branches/users/wsanchez/d2/twistedcaldav/stdconfig.py	2012-03-27 19:21:07 UTC (rev 8933)
@@ -877,6 +877,12 @@
         "UseExternalProxies" : False,
     },
 
+    "Manhole": {
+        "Enabled": False,
+        "StartingPortNumber": 5000,
+        "PasswordFilePath": "",
+    },
+
     "EnableKeepAlive": True,
 
     "EnableResponseCache":  True,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120327/c04039b4/attachment.html>


More information about the calendarserver-changes mailing list