diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2014-03-31 17:06:14 +0000 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2014-03-31 17:06:14 +0000 |
commit | 6603d0633de5020c43042bab3aad5bd0a8b1d41e (patch) | |
tree | db3865757cd2b526f9dbca0ef6a42ea7c949d998 | |
parent | 947af57daee51f2a9a86be544d93d15d940d51d7 (diff) | |
download | lorry-controller-6603d0633de5020c43042bab3aad5bd0a8b1d41e.tar.gz |
Add support for non-ssh URLs for constructed lorries
-rw-r--r-- | lorrycontroller/lstroves.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lorrycontroller/lstroves.py b/lorrycontroller/lstroves.py index 8c80907..d2ca301 100644 --- a/lorrycontroller/lstroves.py +++ b/lorrycontroller/lstroves.py @@ -119,7 +119,7 @@ class TroveRepositoryLister(object): lorry = { local_path: { 'type': 'git', - 'url': 'ssh://git@%s/%s' % (trovehost, remote_path), + 'url': self.construct_lorry_url(trove_info, remote_path), 'refspecs': [ "+refs/heads/*", "+refs/tags/*", @@ -140,6 +140,19 @@ class TroveRepositoryLister(object): for local_path in delete_local_paths: statedb.remove_lorry(local_path) + def construct_lorry_url(self, trove_info, remote_path): + vars = dict(trove_info) + vars['remote_path'] = remote_path + + patterns = { + 'ssh': 'ssh://git@{trovehost}/{remote_path}', + 'https': + 'https://{username}:{password}@{trovehost}/git/{remote_path}', + 'http': 'http://{trovehost}/git/{remote_path}', + } + + return patterns[trove_info['protocol']].format(**vars) + class ForceLsTrove(lorrycontroller.LorryControllerRoute): |