[Buildbot-commits] buildbot/buildbot/status client.py,1.24,1.25 html.py,1.78,1.79

Brian Warner warner at users.sourceforge.net
Fri Jan 13 08:34:30 UTC 2006


Update of /cvsroot/buildbot/buildbot/buildbot/status
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28379/buildbot/status

Modified Files:
	client.py html.py 
Log Message:
Revision: arch at buildbot.sf.net--2004/buildbot--dev--0--patch-454
Creator:  Brian Warner <warner at lothar.com>

all port= args now accept a strports string: slaveport, Waterfall, etc

	* buildbot/master.py (Manhole.__init__): let port= be a strports
	specification string, but handle a regular int for backwards
	compatibility. This allows "tcp:12345:interface=127.0.0.1" to be
	used in master.cfg to limit connections to just the local host.
	(BuildMaster.loadConfig): same for c['slavePortnum']
	* buildbot/scheduler.py (Try_Userpass.__init__): same
	* buildbot/status/client.py (PBListener.__init__): same
	* buildbot/status/html.py (Waterfall.__init__): same, for both
	http_port and distrib_port. Include backwards-compatibility checks
	so distrib_port can be a filename string and still mean unix:/foo
	* docs/buildbot.texinfo (Setting the slaveport): document it
	(Debug options): same
	(HTML Waterfall): same
	(PBListener): same
	(try): same
	* buildbot/test/test_config.py (ConfigTest): test it

	* buildbot/master.py (BuildMaster.loadConfig): wait for the
	slaveport's disownServiceParent deferred to fire before opening
	the new one. Fixes an annoying bug in the unit tests.


Index: client.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/client.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- client.py	14 Oct 2005 19:42:40 -0000	1.24
+++ client.py	13 Jan 2006 08:34:28 -0000	1.25
@@ -4,7 +4,7 @@
 from twisted.python import log, components
 from twisted.python.failure import Failure
 from twisted.internet import defer, reactor
-from twisted.application import service, internet
+from twisted.application import service, strports
 from twisted.cred import portal, checkers
 
 from buildbot import util, interfaces
@@ -546,6 +546,8 @@
 
     def __init__(self, port, user="statusClient", passwd="clientpw"):
         base.StatusReceiverMultiService.__init__(self)
+        if type(port) is int:
+            port = "tcp:%d" % port
         self.port = port
         self.cred = (user, passwd)
         p = portal.Portal(self)
@@ -553,7 +555,7 @@
         c.addUser(user, passwd)
         p.registerChecker(c)
         f = pb.PBServerFactory(p)
-        s = internet.TCPServer(port, f)
+        s = strports.service(port, f)
         s.setServiceParent(self)
 
     def setServiceParent(self, parent):

Index: html.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/html.py,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- html.py	23 Nov 2005 08:01:23 -0000	1.78
+++ html.py	13 Jan 2006 08:34:28 -0000	1.79
@@ -11,7 +11,7 @@
 from twisted.web import static, html, server, distrib
 from twisted.web.error import NoResource
 from twisted.web.util import Redirect, DeferredResource
-from twisted.application import internet
+from twisted.application import strports
 from twisted.spread import pb
 
 from buildbot.twcompat import implements, Interface
@@ -1633,24 +1633,37 @@
                  categories=None, css=buildbot_css, favicon=buildbot_icon):
         """To have the buildbot run its own web server, pass a port number to
         C{http_port}. To have it run a web.distrib server
-        
-        @type  http_port: int
-        @param http_port: the TCP port number on which the buildbot should
-                          run its own web server, with the Waterfall display
-                          as the root page
 
-        @type  distrib_port: string or int
+        @type  http_port: int or L{twisted.application.strports} string
+        @param http_port: a strports specification describing which port the
+                          buildbot should use for its web server, with the
+                          Waterfall display as the root page. For backwards
+                          compatibility this can also be an int. Use
+                          'tcp:8000' to listen on that port, or
+                          'tcp:12345:interface=127.0.0.1' if you only want
+                          local processes to connect to it (perhaps because
+                          you are using an HTTP reverse proxy to make the
+                          buildbot available to the outside world, and do not
+                          want to make the raw port visible).
+
+        @type  distrib_port: int or L{twisted.application.strports} string
         @param distrib_port: Use this if you want to publish the Waterfall
                              page using web.distrib instead. The most common
-                             case is to provide a string that is a pathname
-                             to the unix socket on which the publisher should
-                             listen (C{os.path.expanduser(~/.twistd-web-pb)}
-                             will match the default settings of a standard
+                             case is to provide a string that is an absolute
+                             pathname to the unix socket on which the
+                             publisher should listen
+                             (C{os.path.expanduser(~/.twistd-web-pb)} will
+                             match the default settings of a standard
                              twisted.web 'personal web server'). Another
                              possibility is to pass an integer, which means
                              the publisher should listen on a TCP socket,
                              allowing the web server to be on a different
-                             machine entirely.
+                             machine entirely. Both forms are provided for
+                             backwards compatibility; the preferred form is a
+                             strports specification like
+                             'unix:/home/buildbot/.twistd-web-pb'. Providing
+                             a non-absolute pathname will probably confuse
+                             the strports parser.
 
         @type  allowForce: bool
         @param allowForce: if True, present a 'Force Build' button on the
@@ -1670,7 +1683,14 @@
         """
         base.StatusReceiverMultiService.__init__(self)
         assert allowForce in (True, False) # TODO: implement others
+        if type(http_port) is int:
+            http_port = "tcp:%d" % http_port
         self.http_port = http_port
+        if distrib_port is not None:
+            if type(distrib_port) is int:
+                distrib_port = "tcp:%d" % distrib_port
+            if distrib_port[0] in "/~.": # pathnames
+                distrib_port = "unix:%s" % distrib_port
         self.distrib_port = distrib_port
         self.allowForce = allowForce
         self.categories = categories
@@ -1705,12 +1725,9 @@
         self.site = server.Site(sr)
 
         if self.http_port is not None:
-            s = internet.TCPServer(self.http_port, self.site)
+            s = strports.service(self.http_port, self.site)
             s.setServiceParent(self)
         if self.distrib_port is not None:
             f = pb.PBServerFactory(distrib.ResourcePublisher(self.site))
-            if type(self.distrib_port) == int:
-                s = internet.TCPServer(self.distrib_port, f)
-            else:
-                s = internet.UNIXServer(self.distrib_port, f)
+            s = strports.service(self.distrib_port, f)
             s.setServiceParent(self)





More information about the Commits mailing list