diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2014-03-31 14:14:54 +0000 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2014-03-31 14:14:54 +0000 |
commit | 7c8c009998fa9562f78f4b29d524931f46c26f1d (patch) | |
tree | 8952a6eeeb7b649650f5b455eaa5ddcb79ab531b | |
parent | a630519793291963e33c05bd8d3a675d67c52433 (diff) | |
download | lorry-controller-7c8c009998fa9562f78f4b29d524931f46c26f1d.tar.gz |
Revert "Use GitanoCommand in givemejob"
This reverts commit a630519793291963e33c05bd8d3a675d67c52433.
-rw-r--r-- | lorrycontroller/givemejob.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lorrycontroller/givemejob.py b/lorrycontroller/givemejob.py index d7bc4ed..e40de5f 100644 --- a/lorrycontroller/givemejob.py +++ b/lorrycontroller/givemejob.py @@ -25,6 +25,13 @@ import cliapp import lorrycontroller +class GitanoCommandFailure(Exception): + + def __init__(self, trovehost, command): + Exception.__init__( + self, 'Failed to run "%s" on Gitano on %s' % (command, trovehost)) + + class GiveMeJob(lorrycontroller.LorryControllerRoute): http_method = 'POST' @@ -103,7 +110,7 @@ class GiveMeJob(lorrycontroller.LorryControllerRoute): self.set_gitano_config( 'localhost', lorry_info['path'], 'project.description', desc) - except lorrycontroller.GitanoCommandFailure as e: + except GitanoCommandFailure as e: logging.error('ERROR: %s' % str(e)) bottle.abort(500) @@ -113,7 +120,7 @@ class GiveMeJob(lorrycontroller.LorryControllerRoute): 'config', cliapp.shell_quote(repo_path), 'show']) if exit: - raise lorrycontroller.GitanoCommandFailure(trovehost, 'config show') + raise GitanoCommandFailure(trovehost, 'config show') # "config REPO show" outputs a sequence of lines of the form "key: value". # Extract those into a collections.defaultdict. @@ -133,7 +140,7 @@ class GiveMeJob(lorrycontroller.LorryControllerRoute): 'set', cliapp.shell_quote(key), cliapp.shell_quote(value)]) if exit: - raise lorrycontroller.GitanoCommandFailure(trovehost, 'config set') + raise GitanoCommandFailure(trovehost, 'config set') def give_job_to_minion(self, statedb, lorry_info, now): path = lorry_info['path'] |