Use os.path.join for git driver getGitUrl

The current code uses a format string with an unconditional injection
of a /. This can result in a double-slash which can then cause git to
be unable to clone things. That in turn can lead to an indefinite hang
of a job trying to use the repo from the git driver.

Replace the format string with os.path.join which will correctly join
the project to the baseurl whether it's a url or a bare path, and
whether or not it has a trailing slash.

Change-Id: Id0e529b916ff75d6b6df98d978d2349f6037499c
This commit is contained in:
Monty Taylor 2019-01-15 09:56:19 +00:00
parent a5d6edbae7
commit 1779565108
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
2 changed files with 6 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Fixed an issue where a trailing slash on the baseurl of a git driver
connection config could cause an indefinite job hang.

View File

@ -231,8 +231,7 @@ class GitConnection(BaseConnection):
return branches
def getGitUrl(self, project):
url = '%s/%s' % (self.baseurl, project.name)
return url
return os.path.join(self.baseurl, project.name)
def onLoad(self):
self.log.debug("Starting Git Watcher")