Add version specific changes for git-url

With the upgrade of opendev's gerrit to 3.2.5.1, the git clones are
failing because the repository url no longer has p/ in it. This change
adds p/ in only if the version is less than 3 when we do a version check.

Change-Id: Id05cfa6449c6c36dd59c7efd74d57cebafcb78c6
This commit is contained in:
Alex Schultz 2020-11-23 15:46:39 -07:00
parent f49f27db59
commit 3027ce2735
2 changed files with 4 additions and 1 deletions

View File

@ -184,7 +184,7 @@ class Config(object):
# And this is to allow Git callouts
os.environ['GIT_SSL_CAINFO'] = self.ssl_ca_path
self.git_root = os.path.expanduser(server['git-root'])
git_url = server.get('git-url', self.url + 'p/')
git_url = server.get('git-url', self.url)
if not git_url.endswith('/'):
git_url += '/'
self.git_url = git_url

View File

@ -1673,6 +1673,9 @@ class Sync(object):
if len(parts) > 2:
micro = int(parts[2])
self.version = (major, minor, micro)
if self.version < (3,0,0):
# version 3 doesn't use a /p/ prefix.
self.app.config.git_url = self.app.config.git_url + 'p/'
self.log.info("Remote version is: %s (parsed as %s)" % (version, self.version))
def query(self, queries):