예제 #1
0
def upgradeMaster(config, _noMonkey=False):
    if not _noMonkey:  # pragma: no cover
        monkeypatches.patch_all()

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

    os.chdir(config['basedir'])

    configFile = base.getConfigFileWithFallback(config['basedir'])
    master_cfg = loadConfig(config, configFile)
    if not master_cfg:
        defer.returnValue(1)
        return

    upgradeFiles(config)
    try:
        yield upgradeDatabase(config, master_cfg)
    except Exception as e:
        print "UNEXPECTED ERROR: %s" % str(e)
        print "Buildmaster failed to upgrade." % str(e)
        defer.returnValue(1)
        return

    if not config['quiet']:
        print "upgrade complete"

    defer.returnValue(0)
예제 #2
0
 def test_tacFallback_noFallback(self):
     defaultFilename = self.filename
     with open(self.filename, "wt") as f:
         f.write("#dummy")
     self.filename = base.getConfigFileWithFallback(self.basedir)
     self.assertEqual(self.filename,
                      os.path.join(self.basedir, defaultFilename))
예제 #3
0
 def test_tacFallback_location_from_tac(self):
     tacfile = os.path.join(self.basedir, "buildbot.tac")
     otherConfigFile = os.path.join(self.basedir, "other.cfg")
     with open(tacfile, "wt") as f:
         f.write("configfile = '%s'" % otherConfigFile)
     with open(otherConfigFile, "wt") as f:
         f.write("#dummy")
     self.filename = base.getConfigFileWithFallback(self.basedir)
     self.assertEqual(self.filename, otherConfigFile)
예제 #4
0
def upgradeMaster(config, _noMonkey=False):
    if not _noMonkey:  # pragma: no cover
        monkeypatches.patch_all()

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

    os.chdir(config['basedir'])

    configFile = base.getConfigFileWithFallback(config['basedir'])
    master_cfg = loadConfig(config, configFile)
    if not master_cfg:
        defer.returnValue(1)
        return

    upgradeFiles(config)
    yield upgradeDatabase(config, master_cfg)

    if not config['quiet']:
        print "upgrade complete"

    defer.returnValue(0)
예제 #5
0
def upgradeMaster(config, _noMonkey=False):
    if not _noMonkey: # pragma: no cover
        monkeypatches.patch_all()

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

    os.chdir(config['basedir'])

    configFile = base.getConfigFileWithFallback(config['basedir'])
    master_cfg = loadConfig(config, configFile)
    if not master_cfg:
        defer.returnValue(1)
        return

    upgradeFiles(config)
    yield upgradeDatabase(config, master_cfg)

    if not config['quiet']:
        print "upgrade complete"

    defer.returnValue(0)
예제 #6
0
 def __init__(self, basedir=os.getcwd(), configFileName='master.cfg'):
     self.basedir = os.path.abspath(basedir)
     self.configFileName = getConfigFileWithFallback(basedir, configFileName)