diff options
Diffstat (limited to 'lorrycontroller/givemejob.py')
-rw-r--r-- | lorrycontroller/givemejob.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lorrycontroller/givemejob.py b/lorrycontroller/givemejob.py index 0d9e6ab..dd4de87 100644 --- a/lorrycontroller/givemejob.py +++ b/lorrycontroller/givemejob.py @@ -1,4 +1,4 @@ -# Copyright (C) 2014-2015 Codethink Limited +# Copyright (C) 2014-2016 Codethink Limited # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -68,6 +68,8 @@ class GiveMeJob(lorrycontroller.LorryControllerRoute): self.create_repository_in_local_trove(statedb, lorry_info) elif api == 'gerrit': self.create_gerrit_project(statedb, lorry_info) + elif api == 'gitlab': + self.create_gitlab_project(statedb, lorry_info) def create_repository_in_local_trove(self, statedb, lorry_info): # Create repository on local Trove. If it fails, assume @@ -101,6 +103,18 @@ class GiveMeJob(lorrycontroller.LorryControllerRoute): gerrit.create_project(project_name) logging.info('Created %s project in local Gerrit.', project_name) + def create_gitlab_project(self, statedb, lorry_info): + gitlab = lorrycontroller.Gitlab( + 'localhost', self.app_settings['gitlab-private-token']) + project_name = lorry_info['path'] + + if gitlab.has_project(project_name): + logging.info('Project %s exists in local GitLab already.', + project_name) + else: + gitlab.create_project(lorry_info['path']) + logging.info('Created %s project in local GitLab.', project_name) + def copy_repository_metadata(self, statedb, lorry_info): '''Copy project.head and project.description to the local Trove.''' |