From 81d4002b9a94fee26be8cf3a9b8e67306d3d6dd7 Mon Sep 17 00:00:00 2001 From: Jonathan Maw Date: Thu, 14 Oct 2021 17:42:31 +0100 Subject: WIP: supply a single repository name to all raw-file mirrors instead of using the lorry's path --- lorrycontroller/givemejob.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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.''' -- cgit v1.2.1