summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Maw <jonathan.maw@codethink.co.uk>2021-10-14 17:42:31 +0100
committerJonathan Maw <jonathan.maw@codethink.co.uk>2021-10-14 17:42:31 +0100
commit81d4002b9a94fee26be8cf3a9b8e67306d3d6dd7 (patch)
tree718dd30f236c97e9ac82adbf079c23776f0a6825
parent0847da03f385337f0303f0d723de7ba58c6329de (diff)
downloadlorry-controller-jonathanmaw/raw-file-mirror.tar.gz
WIP: supply a single repository name to all raw-file mirrors instead of using the lorry's pathjonathanmaw/raw-file-mirror
-rw-r--r--lorrycontroller/givemejob.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/lorrycontroller/givemejob.py b/lorrycontroller/givemejob.py
index 2f7580f..22706cd 100644
--- a/lorrycontroller/givemejob.py
+++ b/lorrycontroller/givemejob.py
@@ -40,10 +40,15 @@ class GiveMeJob(lorrycontroller.LorryControllerRoute):
for lorry_info in lorry_infos:
if self.ready_to_run(lorry_info, now):
metadata = self.get_repo_metadata(statedb, lorry_info)
+ if self.get_lorry_type(lorry_info) == 'raw-file':
+ # XXX: won't work, needs the prefix too
+ path = 'raw-file-mirrors' # TODO: Make this configurable
+ else:
+ path = lorry_info['path']
downstream_type = lorrycontroller.downstream_types[
self.app_settings['git-server-type']]
downstream_type(self.app_settings) \
- .prepare_repo(lorry_info['path'], metadata)
+ .prepare_repo(path, metadata)
self.give_job_to_minion(statedb, lorry_info, now)
logging.info(
@@ -167,6 +172,12 @@ class GiveMeJob(lorrycontroller.LorryControllerRoute):
return host_name, metadata
+ def get_lorry_type(self, lorry_info):
+ '''Get the type of lorry (e.g. git, svn...)'''
+ obj = json.loads(lorry_info['text'])
+ logging.debug("reading lorry types from object '%s'", repr(obj))
+ return list(obj.values())[0]['type']
+
def get_repo_metadata(self, statedb, lorry_info):
'''Get repository head and description.'''