From 536cec4fec506ebdaad6570d1f85f273dec57dd2 Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Wed, 8 Jun 2016 11:26:20 -0400 Subject: [PATCH] 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 --- tools/check_valid_gerrit_projects.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/check_valid_gerrit_projects.py b/tools/check_valid_gerrit_projects.py index cdbc1740de..aaf2c36ebc 100755 --- a/tools/check_valid_gerrit_projects.py +++ b/tools/check_valid_gerrit_projects.py @@ -31,7 +31,7 @@ def tempdir(): reqroot = tempfile.mkdtemp() yield reqroot finally: - shutil.rmtree(reqroot) + shutil.rmtree(reqroot, ignore_errors=True) def check_repo(repo_path): @@ -140,7 +140,15 @@ def main(): # but not git@ upstream = p.get('upstream') 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: for prefix in VALID_SCHEMES: if upstream.startswith(prefix):