def stop_master(obj, clean, no_wait): """Stop the buildmaster It is a wrapper around `buildbot stop`. """ from buildbot.scripts.stop import stop command_cfg = { 'basedir': obj['config_path'].parent.absolute(), 'quiet': False, 'clean': clean, 'no-wait': no_wait } stop(command_cfg)
def do_test_stop(self, config, kill_sequence, is_running=True, **kwargs): with open(os.path.join('basedir', 'buildbot.tac'), 'wt') as f: f.write("Application('buildmaster')") if is_running: with open("basedir/twistd.pid", 'wt') as f: f.write('1234') def sleep(t): self.assertTrue(kill_sequence, "unexpected sleep: %d" % t) what, exp_t = kill_sequence.pop(0) self.assertEqual((what, exp_t), ('sleep', t)) self.patch(time, 'sleep', sleep) def kill(pid, signal): self.assertTrue(kill_sequence, "unexpected signal: %d" % signal) exp_sig, result = kill_sequence.pop(0) self.assertEqual((pid, signal), (1234, exp_sig)) if isinstance(result, Exception): raise result else: return result self.patch(os, 'kill', kill) rv = stop.stop(config, **kwargs) self.assertEqual(kill_sequence, []) return rv
def do_test_stop(self, config, kill_sequence, is_running=True, **kwargs): with open(os.path.join("basedir", "buildbot.tac"), "wt") as f: f.write("Application('buildmaster')") if is_running: with open("basedir/twistd.pid", "wt") as f: f.write("1234") def sleep(t): what, exp_t = kill_sequence.pop(0) self.assertEqual((what, exp_t), ("sleep", t)) self.patch(time, "sleep", sleep) def kill(pid, signal): exp_sig, result = kill_sequence.pop(0) self.assertEqual((pid, signal), (1234, exp_sig)) if isinstance(result, Exception): raise result else: return result self.patch(os, "kill", kill) rv = stop.stop(config, **kwargs) self.assertEqual(kill_sequence, []) return rv
def restart(config): basedir = config['basedir'] quiet = config['quiet'] if not base.isBuildmasterDir(basedir): return 1 if stop.stop(config, wait=True) != 0: return 1 if not quiet: print("now restarting buildbot process..") return start.start(config)
def restart(config): basedir = config["basedir"] quiet = config["quiet"] if not base.isBuildmasterDir(basedir): print "not a buildmaster directory" return 1 if stop.stop(config, wait=True) != 0: return 1 if not quiet: print "now restarting buildbot process.." return start.start(config)
def stop_master(obj, clean, no_wait): """Stop the buildmaster It is a wrapper around `buildbot stop`. """ from buildbot.scripts.stop import stop command_cfg = { 'basedir': obj['config_path'].parent.absolute(), 'quiet': False, 'clean': clean, 'no-wait': no_wait } result = stop(command_cfg) if result > 0: raise click.Abort('Failed to stop the Buildbot master!') click.echo('Buildbot has been successfully stopped!')