From d403ccf5fa4e8dfca6dd92174580034cffa1ecfb Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Wed, 13 May 2020 06:45:36 -0500 Subject: [PATCH] Update missing cmd to follow redirects Handles redirection in the link checking for artifacts. Also drops looking for py2 wheels since we now only have py3. Change-Id: I34b201902faa60795dae44ebf059af0f2f9242c6 Signed-off-by: Sean McGinnis --- openstack_releases/cmds/missing.py | 43 +++++++++++++++--------------- openstack_releases/links.py | 5 ++-- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/openstack_releases/cmds/missing.py b/openstack_releases/cmds/missing.py index 33abe64cef..c58c5eb2ec 100644 --- a/openstack_releases/cmds/missing.py +++ b/openstack_releases/cmds/missing.py @@ -12,9 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -"""Look for releases listed in a series but not actually tagged. - -""" +"""Look for releases listed in a series but not actually tagged.""" import argparse import glob @@ -142,25 +140,26 @@ def main(): print(' apparently not a python module') continue - wheel_2_errors = list( + wheel_errors = list( check_url( - 'python 2 wheel', - links.wheel_py2_url(version, project) + 'python 3 wheel', + links.wheel_py3_url(version, project) ) ) - wheel_both_errors = list( - check_url( - 'python 2/3 wheel', - links.wheel_both_url(version, project) + has_23_wheel = False + if wheel_errors: + has_23_wheel = True + # Check if there is actually a 2/3 wheel + wheel_errors = list( + check_url( + 'python 2/3 wheel', + links.wheel_both_url(version, project) + ) ) - ) - # We only expect to find one wheel. Look for both, - # and minimize what we report as errors. - if wheel_2_errors and wheel_both_errors: - # We have neither wheel. - errors.extend(wheel_2_errors) - errors.extend(wheel_both_errors) - elif not wheel_both_errors: + if wheel_errors: + # We are missing the wheel. + errors.extend(wheel_errors) + elif has_23_wheel: # We have the "both" wheel, so check for the # signature file. errors.extend( @@ -170,13 +169,13 @@ def main(): project) + '.asc', ) ) - elif not wheel_2_errors: - # We have the py2 wheel, so check for the + else: + # We have the py3 wheel, so check for the # signature file. errors.extend( check_url( - 'python 2 wheel signature', - links.wheel_py2_url(version, + 'python 3 wheel signature', + links.wheel_py3_url(version, project) + '.asc', ) ) diff --git a/openstack_releases/links.py b/openstack_releases/links.py index d016df9e13..3e0788682a 100644 --- a/openstack_releases/links.py +++ b/openstack_releases/links.py @@ -21,6 +21,7 @@ def link_exists(url): response = requests.head( url, headers={'user-agent': 'openstack-release-link-checker'}, + allow_redirects=True, ) missing = ( (response.status_code // 100 != 2) or @@ -43,10 +44,10 @@ def tarball_url(version, project): ) -def wheel_py2_url(version, project): +def wheel_py3_url(version, project): repo_base = project.repo.base_name base = project.tarball_base or repo_base - return '{s}/{r}/{n}-{v}-py2-none-any.whl'.format( + return '{s}/{r}/{n}-{v}-py3-none-any.whl'.format( s='https://tarballs.openstack.org', v=version, r=repo_base,