1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 import os, sys
18 from buildbot.scripts import base
19 from twisted.internet import reactor, protocol
20 from twisted.python.runtime import platformType
21 from buildbot.scripts.logwatcher import LogWatcher
22 from buildbot.scripts.logwatcher import BuildmasterTimeoutError
23 from buildbot.scripts.logwatcher import ReconfigError
24
27 self.rc = 0
28 print "Following twistd.log until startup finished.."
29 lw = LogWatcher(os.path.join(basedir, "twistd.log"))
30 d = lw.start()
31 d.addCallbacks(self._success, self._failure)
32 reactor.run()
33 return self.rc
34
36 print "The buildmaster appears to have (re)started correctly."
37 self.rc = 0
38 reactor.stop()
39
41 if why.check(BuildmasterTimeoutError):
42 print """
43 The buildmaster took more than 10 seconds to start, so we were unable to
44 confirm that it started correctly. Please 'tail twistd.log' and look for a
45 line that says 'configuration update complete' to verify correct startup.
46 """
47 elif why.check(ReconfigError):
48 print """
49 The buildmaster appears to have encountered an error in the master.cfg config
50 file during startup. Please inspect and fix master.cfg, then restart the
51 buildmaster.
52 """
53 else:
54 print """
55 Unable to confirm that the buildmaster started correctly. You may need to
56 stop it, fix the config file, and restart.
57 """
58 print why
59 self.rc = 1
60 reactor.stop()
61
63 os.chdir(config['basedir'])
64 sys.path.insert(0, os.path.abspath(config['basedir']))
65
66 argv = ["twistd",
67 "--no_save",
68 '--nodaemon',
69 "--logfile=twistd.log",
70 "--python=buildbot.tac"]
71 sys.argv = argv
72
73
74
75
76 from twisted.scripts import twistd
77 twistd.run()
78
80 os.chdir(config['basedir'])
81 sys.path.insert(0, os.path.abspath(config['basedir']))
82
83
84
85
86 argv = [sys.executable,
87 "-c",
88
89
90
91 "from twisted.scripts import twistd; twistd.run()",
92 "--no_save",
93 "--logfile=twistd.log",
94 "--python=buildbot.tac"]
95
96
97 reactor.spawnProcess(protocol.ProcessProtocol(), sys.executable, argv, env=os.environ)
98
117