From a630519793291963e33c05bd8d3a675d67c52433 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Mon, 31 Mar 2014 14:14:15 +0000 Subject: Use GitanoCommand in givemejob --- lorrycontroller/givemejob.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/lorrycontroller/givemejob.py b/lorrycontroller/givemejob.py index e40de5f..d7bc4ed 100644 --- a/lorrycontroller/givemejob.py +++ b/lorrycontroller/givemejob.py @@ -25,13 +25,6 @@ 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' @@ -110,7 +103,7 @@ class GiveMeJob(lorrycontroller.LorryControllerRoute): self.set_gitano_config( 'localhost', lorry_info['path'], 'project.description', desc) - except GitanoCommandFailure as e: + except lorrycontroller.GitanoCommandFailure as e: logging.error('ERROR: %s' % str(e)) bottle.abort(500) @@ -120,7 +113,7 @@ class GiveMeJob(lorrycontroller.LorryControllerRoute): 'config', cliapp.shell_quote(repo_path), 'show']) if exit: - raise GitanoCommandFailure(trovehost, 'config show') + raise lorrycontroller.GitanoCommandFailure(trovehost, 'config show') # "config REPO show" outputs a sequence of lines of the form "key: value". # Extract those into a collections.defaultdict. @@ -140,7 +133,7 @@ class GiveMeJob(lorrycontroller.LorryControllerRoute): 'set', cliapp.shell_quote(key), cliapp.shell_quote(value)]) if exit: - raise GitanoCommandFailure(trovehost, 'config set') + raise lorrycontroller.GitanoCommandFailure(trovehost, 'config set') def give_job_to_minion(self, statedb, lorry_info, now): path = lorry_info['path'] -- cgit v1.2.1