From dd63733b55bbad92172d805b44ddda7743801d45 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Wed, 21 Aug 2024 10:01:31 -0700 Subject: [PATCH] Omnibus fixes for running jobs on Noble with Python3.12 We bumped the default nodeset to ubuntu-noble which bumped our python version up to python3.12. We were previously pinning hacking to a version that pulls in a version of flake8 that isn't compatible with python3.12 due to entrypoint importlib_metadata compatibility issues. We fix that by updating hacking to lastest, but that introduces a new rule that requires we have whitespace after a return statement. We also fix that in the one location that was a problem. Then separately ssl.wrap_context has been removed in python 3.12 so we switch that out with SSLContext.wrap_context instead when checking irc access in the irc access check job. Change-Id: Id4e3c6f35ffcf5cea302aa1bd8b126affa4eeb07 --- roles/copy-wheels/files/wheel-indexer.py | 2 +- tools/check_irc_access.py | 8 +++++++- tox.ini | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/roles/copy-wheels/files/wheel-indexer.py b/roles/copy-wheels/files/wheel-indexer.py index 75ceeda8bb..c3c27044b3 100644 --- a/roles/copy-wheels/files/wheel-indexer.py +++ b/roles/copy-wheels/files/wheel-indexer.py @@ -91,7 +91,7 @@ def get_sha256(filename): with open(filename, "rb") as f: for b in iter(lambda: f.read(4096), b''): sha256.update(b) - return(sha256.hexdigest()) + return sha256.hexdigest() def create_index(path, files): diff --git a/tools/check_irc_access.py b/tools/check_irc_access.py index 7d90b89129..1431ae9576 100755 --- a/tools/check_irc_access.py +++ b/tools/check_irc_access.py @@ -142,7 +142,13 @@ def main(): for x in range(16)) port = int(args.port) if port == 6697: - factory = irc.connection.Factory(wrapper=ssl.wrap_socket) + context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) + # Set to false as the irc connection factory doesn't pass the + # server hostname into the wrapper which is required for hostname + # checking. Since this is just for testing risk is low. + context.check_hostname = False + context.verify_mode = ssl.CERT_NONE + factory = irc.connection.Factory(wrapper=context.wrap_socket) a.connect(args.server, int(args.port), mynick, connect_factory=factory) else: diff --git a/tox.ini b/tox.ini index ad6fca00d4..7716c27336 100644 --- a/tox.ini +++ b/tox.ini @@ -37,7 +37,7 @@ deps = # pin these two until someone has time to update all our skips to >=6.16 ansible-lint>=6.0.0,<6.5.0 ansible-compat<4 - hacking>=4.0.0,<5.0.0 + hacking>=7.0.0,<8.0.0 bashate>=0.2 commands = {toxinidir}/tools/ansible-lint-roles-cache.sh