[Buildbot-commits] buildbot/buildbot/clients base.py,1.12,1.13
Brian Warner
warner at users.sourceforge.net
Fri Nov 24 19:27:13 UTC 2006
Update of /cvsroot/buildbot/buildbot/buildbot/clients
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9198/buildbot/clients
Modified Files:
base.py
Log Message:
[project @ buildbot statuslog: add reminders to connect to a PBListener port instead of the slaveport]
Original author: warner at lothar.com
Date: 2006-11-24 19:25:21
Index: base.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/clients/base.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- base.py 19 Jul 2005 23:12:01 -0000 1.12
+++ base.py 24 Nov 2006 19:27:11 -0000 1.13
@@ -3,7 +3,7 @@
import sys, re
from twisted.spread import pb
-from twisted.cred import credentials
+from twisted.cred import credentials, error
from twisted.internet import reactor
class StatusClient(pb.Referenceable):
@@ -93,15 +93,30 @@
creds = credentials.UsernamePassword("statusClient", "clientpw")
d = cf.login(creds)
reactor.connectTCP(host, port, cf)
- d.addCallback(self.connected)
+ d.addCallbacks(self.connected, self.not_connected)
return d
def connected(self, ref):
ref.notifyOnDisconnect(self.disconnected)
self.listener.connected(ref)
-
+ def not_connected(self, why):
+ if why.check(error.UnauthorizedLogin):
+ print """
+Unable to login.. are you sure we are connecting to a
+buildbot.status.client.PBListener port and not to the slaveport?
+"""
+ reactor.stop()
+ return why
def disconnected(self, ref):
print "lost connection"
- reactor.stop()
+ # we can get here in one of two ways: the buildmaster has
+ # disconnected us (probably because it shut itself down), or because
+ # we've been SIGINT'ed. In the latter case, our reactor is already
+ # shut down, but we have no easy way of detecting that. So protect
+ # our attempt to shut down the reactor.
+ try:
+ reactor.stop()
+ except RuntimeError:
+ pass
if __name__ == '__main__':
master = "localhost:8007"
More information about the Commits
mailing list