diff options
Diffstat (limited to 'lorrycontroller/gitlab.py')
-rw-r--r-- | lorrycontroller/gitlab.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lorrycontroller/gitlab.py b/lorrycontroller/gitlab.py index 759cdb0..4fdbab2 100644 --- a/lorrycontroller/gitlab.py +++ b/lorrycontroller/gitlab.py @@ -37,9 +37,8 @@ class MissingGitlabModuleError(Exception): pass -def _init_gitlab(host, token): +def _init_gitlab(url, token): if gitlab: - url = "http://" + host return gitlab.Gitlab(url, token) else: raise MissingGitlabModuleError('gitlab module missing\n' @@ -61,10 +60,10 @@ class GitlabDownstream(hosts.DownstreamHost): app_settings.require('gitlab-private-token') def __init__(self, app_settings): - # XXX This needs to be configurable - host = 'localhost' - - self.gl = _init_gitlab(host, app_settings['gitlab-private-token']) + url = app_settings['downstream-http-url'] + if url is None: + url = 'http://localhost/' + self.gl = _init_gitlab(url, app_settings['gitlab-private-token']) self._visibility = app_settings['downstream-visibility'] @@ -149,8 +148,11 @@ class GitlabUpstream(hosts.UpstreamHost): def __init__(self, host_info): self._protocol = host_info['protocol'] - self.gl = _init_gitlab(host_info['host'], - host_info['type_params']['private-token']) + if self._protocol == 'ssh': + url = 'https://%(host)s/' % host_info + else: + url = '%(protocol)s://%(host)s/' % host_info + self.gl = _init_gitlab(url, host_info['type_params']['private-token']) def list_repos(self): '''List projects on a GitLab instance.''' |