summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lorrycontroller/gitano.py6
-rw-r--r--lorrycontroller/givemejob.py12
2 files changed, 13 insertions, 5 deletions
diff --git a/lorrycontroller/gitano.py b/lorrycontroller/gitano.py
index d2cfdb3..f2f33b0 100644
--- a/lorrycontroller/gitano.py
+++ b/lorrycontroller/gitano.py
@@ -33,6 +33,12 @@ class GitanoCommand(object):
def __init__(self, trovehost):
self.trovehost = trovehost
+ def create(self, repo_path):
+ exit, stdout, stderr = cliapp.runcmd_unchecked(
+ ['ssh', 'git@%s' % self.trovehost, 'create', repo_path])
+ if exit:
+ raise GitanoCommandFailure(self.trovehost, 'create %s' % repo_path)
+
def get_gitano_config_for_repo(self, repo_path):
exit, stdout, stderr = cliapp.runcmd_unchecked(
['ssh', 'git@%s' % self.trovehost,
diff --git a/lorrycontroller/givemejob.py b/lorrycontroller/givemejob.py
index a60da88..f620734 100644
--- a/lorrycontroller/givemejob.py
+++ b/lorrycontroller/givemejob.py
@@ -71,12 +71,14 @@ class GiveMeJob(lorrycontroller.LorryControllerRoute):
# Create repository on local Trove. If it fails, assume
# it failed because the repository already existed, and
# ignore the failure (but log message).
- exit, stdout, stderr = cliapp.runcmd_unchecked(
- ['ssh', 'git@localhost', 'create', lorry_info['path']])
- if exit:
+
+ local = lorrycontroller.GitanoCommand('localhost')
+ try:
+ local.create(lorry_info['path'])
+ except lorrycontroller.GitanoCommandFailure as e:
logging.debug(
- 'Ignoring error creating %s on local Trove:\n%s\n%s',
- lorry_info['path'], stdout, stderr)
+ 'Ignoring error creating %s on local Trove: %s',
+ lorry_info['path'], e)
else:
logging.info('Created %s on local repo', lorry_info['path'])