HTTP check existing repositories

Instead of using git to check whether an existing opendev.org
repository exists when and upstream source is specified, just
use a simple HTTP check using urllib.

This avoids any authentication style guesses git clients may
make when a repo is not visible.

Change-Id: Ibee29eee84ae3890a9017edf287de1415d658c39
This commit is contained in:
James Page 2022-07-18 21:36:17 +01:00
parent bbdd63d457
commit 2c5223cf2d
1 changed files with 4 additions and 2 deletions

View File

@ -22,6 +22,8 @@ import re
import shutil
import sys
import tempfile
import urllib.error
import urllib.request
import yaml
@ -221,8 +223,8 @@ def main():
try:
# Check to see if we have already imported the project into
# OpenStack, if so skip checking upstream.
check_repo(openstack_repo, default_branch)
except git.exc.GitCommandError:
urllib.request.urlopen(openstack_repo)
except urllib.error.HTTPError:
# We haven't imported the repo yet, make sure upstream is
# valid.
found_errors += check_repo(upstream, default_branch)