Skip to content

Commit

Permalink
align startup and reconfig messages in master and logwatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
djmitche committed Nov 18, 2011
1 parent b687470 commit d095ee3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 37 deletions.
4 changes: 3 additions & 1 deletion master/buildbot/master.py
Expand Up @@ -245,7 +245,6 @@ def reconfig(self):

@d.addBoth
def cleanup(res):
log.msg("configuration update complete")
timer.stop()
self.reconfig_notifier.stop()
self.reconfig_notifier = None
Expand All @@ -262,6 +261,7 @@ def cleanup(res):

@defer.deferredGenerator
def doReconfig(self):
log.msg("beginning configuration update")
changes_made = False
failed = False
try:
Expand Down Expand Up @@ -289,6 +289,8 @@ def doReconfig(self):
"may malfunction")
else:
log.msg("reconfig aborted without making any changes")
else:
log.msg("configuration update complete")


def reconfigService(self, new_config):
Expand Down
18 changes: 5 additions & 13 deletions master/buildbot/scripts/logwatcher.py
Expand Up @@ -24,12 +24,8 @@ class FakeTransport:

class BuildmasterTimeoutError(Exception):
pass
class BuildslaveTimeoutError(Exception):
pass
class ReconfigError(Exception):
pass
class BuildSlaveDetectedError(Exception):
pass

class TailProcess(protocol.ProcessProtocol):
def outReceived(self, data):
Expand All @@ -49,7 +45,6 @@ def __init__(self, logfile):
self.transport = FakeTransport()
self.pp = TailProcess()
self.pp.lw = self
self.processtype = "buildmaster"
self.timer = None

def start(self):
Expand Down Expand Up @@ -77,10 +72,7 @@ def _start(self):

def timeout(self):
self.timer = None
if self.processtype == "buildmaster":
e = BuildmasterTimeoutError()
else:
e = BuildslaveTimeoutError()
e = BuildmasterTimeoutError()
self.finished(Failure(e))

def finished(self, results):
Expand All @@ -100,17 +92,17 @@ def lineReceived(self, line):
return
if "Log opened." in line:
self.in_reconfig = True
if "loading configuration from" in line:
if "beginning configuration update" in line:
self.in_reconfig = True
if "Creating BuildSlave" in line:
self.processtype = "buildslave"

if self.in_reconfig:
print line

if "message from master: attached" in line:
return self.finished("buildslave")
if "I will keep using the previous config file" in line:
if "reconfig aborted" in line or 'reconfig partially applied' in line:
return self.finished(Failure(ReconfigError()))
if "configuration update complete" in line:
return self.finished("buildmaster")
if "BuildMaster is running" in line:
return self.finished("buildmaster")
29 changes: 6 additions & 23 deletions master/buildbot/scripts/startup.py
Expand Up @@ -28,44 +28,27 @@ def follow(self):
reactor.run()
return self.rc

def _success(self, processtype):
def _success(self, _):
from twisted.internet import reactor
print "The %s appears to have (re)started correctly." % processtype
print "The buildmaster appears to have (re)started correctly."
self.rc = 0
reactor.stop()

def _failure(self, why):
from twisted.internet import reactor
from buildbot.scripts.logwatcher import BuildmasterTimeoutError, \
ReconfigError, BuildslaveTimeoutError, BuildSlaveDetectedError
from buildbot.scripts.logwatcher import BuildmasterTimeoutError
from buildbot.scripts.logwatcher import ReconfigError
if why.check(BuildmasterTimeoutError):
print """
The buildmaster took more than 10 seconds to start, so we were unable to
confirm that it started correctly. Please 'tail twistd.log' and look for a
line that says 'configuration update complete' to verify correct startup.
"""
elif why.check(BuildslaveTimeoutError):
print """
The buildslave took more than 10 seconds to start and/or connect to the
buildmaster, so we were unable to confirm that it started and connected
correctly. Please 'tail twistd.log' and look for a line that says 'message
from master: attached' to verify correct startup. If you see a bunch of
messages like 'will retry in 6 seconds', your buildslave might not have the
correct hostname or portnumber for the buildmaster, or the buildmaster might
not be running. If you see messages like
'Failure: twisted.cred.error.UnauthorizedLogin'
then your buildslave might be using the wrong botname or password. Please
correct these problems and then restart the buildslave.
"""
elif why.check(ReconfigError):
print """
The buildmaster appears to have encountered an error in the master.cfg config
file during startup. It is probably running with an empty configuration right
now. Please inspect and fix master.cfg, then restart the buildmaster.
"""
elif why.check(BuildSlaveDetectedError):
print """
Buildslave is starting up, not following logfile.
file during startup. Please inspect and fix master.cfg, then restart the
buildmaster.
"""
else:
print """
Expand Down

0 comments on commit d095ee3

Please sign in to comment.