Skip upstream check if we have already imported upstream

Update our testing to only check upstream if we haven't imported the
repo into openstack.  This will address test failues when users
deleted the upstream repo before removing it from
gerrit/projects.yaml.

Change-Id: I6bd9fe9841dee8be352ed17af44b4cf9cea397fd
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2016-06-08 11:26:20 -04:00
parent b18ceeaf33
commit 536cec4fec
No known key found for this signature in database
GPG Key ID: 611A80832067AF38

View File

@ -31,7 +31,7 @@ def tempdir():
reqroot = tempfile.mkdtemp() reqroot = tempfile.mkdtemp()
yield reqroot yield reqroot
finally: finally:
shutil.rmtree(reqroot) shutil.rmtree(reqroot, ignore_errors=True)
def check_repo(repo_path): def check_repo(repo_path):
@ -140,7 +140,15 @@ def main():
# but not git@ # but not git@
upstream = p.get('upstream') upstream = p.get('upstream')
if upstream and 'track-upstream' not in p.get('options', []): if upstream and 'track-upstream' not in p.get('options', []):
found_errors += check_repo(upstream) openstack_repo = 'https://git.openstack.org/%s' % name
try:
# Check to see if we have already imported the project into
# OpenStack, if so skip checking upstream.
check_repo(openstack_repo)
except git.exc.GitCommandError:
# We haven't imported the repo yet, make sure upstream is
# valid.
found_errors += check_repo(upstream)
if upstream: if upstream:
for prefix in VALID_SCHEMES: for prefix in VALID_SCHEMES:
if upstream.startswith(prefix): if upstream.startswith(prefix):