diff options
Diffstat (limited to 'lorry-controller')
-rwxr-xr-x | lorry-controller | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/lorry-controller b/lorry-controller index 3ba576f..3d30776 100755 --- a/lorry-controller +++ b/lorry-controller @@ -24,6 +24,10 @@ class LorryController(cliapp.Application): 'path to the area for the controller to work in', metavar='PATH', default=defaults['work-area']) + self.settings.boolean(['dry-run'], + "do a dry-run and don't actually do anything " + "beyond updating the git tree", + default=False) self.settings.string(['lorry'], 'path to the lorry binary to use', metavar='LORRY', @@ -34,11 +38,11 @@ class LorryController(cliapp.Application): metavar='CONFNAME', default=defaults['config-name']) self.settings.boolean(['lorry-verbose'], - 'Whether to pass --verbose to lorry' + 'Whether to pass --verbose to lorry', default=True) self.settings.string(['lorry-log'], - 'Log file name for lorry if wanted' - metaval='LORRYLOG', + 'Log file name for lorry if wanted', + metavar='LORRYLOG', default=None) def process_args(self, args): @@ -62,10 +66,9 @@ class LorryController(cliapp.Application): self.lorrycmd=[self.settings['lorry']] if self.settings['lorry-verbose']: - self.lorrycmd += "--verbose" + self.lorrycmd += ["--verbose"] if self.settings['lorry-log'] is not None: - self.lorrycmd += "--log" - self.lorrycmd += self.settings['lorry-log'] + self.lorrycmd += ["--log", self.settings['lorry-log']] if not os.path.exists(os.path.join('git', self.settings['config-name'])): @@ -101,7 +104,8 @@ class LorryController(cliapp.Application): nextdue = self.conf.duetimes[new_lorry] should_create = conf['create'] == "always" if should_create: - logging.debug("TODO: Create in Trove") + self.maybe_runcmd(["ssh", "git@localhost", + "create", new_lorry]) mgr.lorry_state[new_lorry] = { 'conf': conf, 'lorry': lorry, @@ -151,6 +155,11 @@ class LorryController(cliapp.Application): self.runcmd(['git']+args, cwd=os.path.join(self.settings['work-area'], 'git')) + def maybe_runcmd(self, *args, **kwargs): + if not self.settings['dry-run']: + return self.runcmd(*args, **kwargs) + else: + logging.debug("DRY-RUN: Not running %r" % args) if __name__ == '__main__': LorryController(version='1').run() |