summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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.'''