diff options
Diffstat (limited to 'lorry-controller')
-rwxr-xr-x | lorry-controller | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/lorry-controller b/lorry-controller index 3d30776..9d96b9a 100755 --- a/lorry-controller +++ b/lorry-controller @@ -39,7 +39,7 @@ class LorryController(cliapp.Application): default=defaults['config-name']) self.settings.boolean(['lorry-verbose'], 'Whether to pass --verbose to lorry', - default=True) + default=False) self.settings.string(['lorry-log'], 'Log file name for lorry if wanted', metavar='LORRYLOG', @@ -103,14 +103,22 @@ class LorryController(cliapp.Application): lorry = self.conf.lorries[new_lorry] nextdue = self.conf.duetimes[new_lorry] should_create = conf['create'] == "always" + store_state = True if should_create: - self.maybe_runcmd(["ssh", "git@localhost", - "create", new_lorry]) - mgr.lorry_state[new_lorry] = { - 'conf': conf, - 'lorry': lorry, - 'next-due': nextdue, - } + exit, out, err = self.maybe_runcmd(["ssh", "git@localhost", + "create", new_lorry]) + if exit != 0: + logging.info("Unable to create repo %s" % new_lorry) + store_state = False + if store_state: + mgr.lorry_state[new_lorry] = { + 'conf': conf, + 'lorry': lorry, + 'next-due': nextdue, + } + else: + # Remove this from cur_lorries so we don't run it + cur_lorries.remove(new_lorry) # 3. For every lorry we have, update the settings if necessary. # and reset the next-due as appropriate. @@ -157,9 +165,10 @@ class LorryController(cliapp.Application): def maybe_runcmd(self, *args, **kwargs): if not self.settings['dry-run']: - return self.runcmd(*args, **kwargs) + return self.runcmd_unchecked(*args, **kwargs) else: logging.debug("DRY-RUN: Not running %r" % args) + return 0, 'DRY-RUN', 'DRY-RUN' if __name__ == '__main__': LorryController(version='1').run() |