Exemplo n.º 1
0
def _cleanupDatabase(config, _noMonkey=False):

    if not base.checkBasedir(config):
        defer.returnValue(1)
        return

    config["basedir"] = os.path.abspath(config["basedir"])
    os.chdir(config["basedir"])

    with base.captureErrors(
        (SyntaxError, ImportError), "Unable to load 'buildbot.tac' from '%s':" % (config["basedir"],)
    ):
        configFile = base.getConfigFileFromTac(config["basedir"])

    with base.captureErrors(
        config_module.ConfigErrors, "Unable to load '%s' from '%s':" % (configFile, config["basedir"])
    ):
        master_cfg = base.loadConfig(config, configFile)

    if not master_cfg:
        defer.returnValue(1)
        return

    yield doCleanupDatabase(config, master_cfg)

    if not config["quiet"]:
        print("cleanup complete")

    defer.returnValue(0)
Exemplo n.º 2
0
def _cleanupDatabase(config, _noMonkey=False):

    if not base.checkBasedir(config):
        defer.returnValue(1)
        return

    config['basedir'] = os.path.abspath(config['basedir'])
    os.chdir(config['basedir'])

    with base.captureErrors((SyntaxError, ImportError),
                            "Unable to load 'buildbot.tac' from '%s':" %
                            (config['basedir'], )):
        configFile = base.getConfigFileFromTac(config['basedir'])

    with base.captureErrors(
            config_module.ConfigErrors, "Unable to load '%s' from '%s':" %
        (configFile, config['basedir'])):
        master_cfg = base.loadConfig(config, configFile)

    if not master_cfg:
        defer.returnValue(1)
        return

    yield doCleanupDatabase(config, master_cfg)

    if not config['quiet']:
        print("cleanup complete")

    defer.returnValue(0)
Exemplo n.º 3
0
def _cleanupDatabase(config, _noMonkey=False):

    if not base.checkBasedir(config):
        return 1

    config['basedir'] = os.path.abspath(config['basedir'])
    os.chdir(config['basedir'])

    with base.captureErrors(
        (SyntaxError, ImportError),
            f"Unable to load 'buildbot.tac' from '{config['basedir']}':"):
        configFile = base.getConfigFileFromTac(config['basedir'])

    with base.captureErrors(
            config_module.ConfigErrors,
            f"Unable to load '{configFile}' from '{config['basedir']}':"):
        master_cfg = base.loadConfig(config, configFile)

    if not master_cfg:
        return 1

    yield doCleanupDatabase(config, master_cfg)

    if not config['quiet']:
        print("cleanup complete")

    return 0