summaryrefslogtreecommitdiff
path: root/lorrycontroller
diff options
context:
space:
mode:
authorBen Hutchings <ben.hutchings@codethink.co.uk>2020-05-14 00:51:49 +0100
committerBen Hutchings <ben.hutchings@codethink.co.uk>2020-06-01 17:03:47 +0100
commitf5d6b9a5124dd133251aed8202e0ba8a4dda4f4a (patch)
treefc470edb16fef9c426cd063cb66461dbce82d3ad /lorrycontroller
parentce311a3c803515eb95c761a3a2838b093a4ea3cd (diff)
downloadlorry-controller-f5d6b9a5124dd133251aed8202e0ba8a4dda4f4a.tar.gz
GitlabUpstream: Use HTTPS unless explicitly configured not to
Currently we always use the 'http' scheme to talk to GitLab's REST API. Use the 'https' scheme instead, if the configured protocol is 'https' or 'ssh' (as the SSH server doesn't expose this API).
Diffstat (limited to 'lorrycontroller')
-rw-r--r--lorrycontroller/gitlab.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/lorrycontroller/gitlab.py b/lorrycontroller/gitlab.py
index 58bf67f..e77e4bb 100644
--- a/lorrycontroller/gitlab.py
+++ b/lorrycontroller/gitlab.py
@@ -130,7 +130,10 @@ class GitlabUpstream(hosts.UpstreamHost):
def __init__(self, host_info):
self._protocol = host_info['protocol']
- url = 'http://%(host)s/' % host_info
+ 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):