示例#1
0
文件: cli.py 项目: kou/ursabot
def restart_master(obj, no_daemon, start_timeout, clean, no_wait):
    """Restart the buildmaster

    It is a wrapper around `buildbot restart`.
    """
    from buildbot.scripts.restart import restart
    command_cfg = {
        'basedir': obj['config_path'].parent.absolute(),
        'quiet': False,
        'nodaemon': no_daemon,
        'start_timeout': start_timeout,
        'clean': clean,
        'no-wait': no_wait
    }
    restart(command_cfg)
示例#2
0
def restart_master(obj, no_daemon, start_timeout, clean, no_wait):
    """Restart the buildmaster

    It is a wrapper around `buildbot restart`.
    """
    from buildbot.scripts.restart import restart
    command_cfg = {
        'basedir': obj['config_path'].parent.absolute(),
        'quiet': False,
        'nodaemon': no_daemon,
        'start_timeout': start_timeout,
        'clean': clean,
        'no-wait': no_wait
    }
    result = restart(command_cfg)
    if result > 0:
        raise click.Abort('Failed to restart the Buildbot master!')

    url = obj['config'].url
    click.echo('Buildbot UI is available at: ' + click.style(url, fg='green'))
 def test_restart_clean(self):
     self.patch(stop, 'stop', lambda config, wait : 0)
     self.patch(start, 'start', lambda config : 0)
     self.assertEqual(restart.restart(mkconfig(quiet=True, clean=True)), 0)
     self.assertWasQuiet()
 def test_restart_succeeds(self):
     self.patch(stop, 'stop', lambda config, wait : 0)
     self.patch(start, 'start', lambda config : 0)
     self.assertEqual(restart.restart(mkconfig()), 0)
     self.assertInStdout('now restarting')
 def test_restart_stop_succeeds_start_fails(self):
     self.patch(stop, 'stop', lambda config, wait : 0)
     self.patch(start, 'start', lambda config : 1)
     self.assertEqual(restart.restart(mkconfig()), 1)
 def test_restart_not_basedir(self):
     self.assertEqual(restart.restart(mkconfig(basedir='doesntexist')), 1)
     self.assertInStdout('invalid buildmaster directory')