Remove Python 3.8 support

Python 3.8 is no longer part of tested runtimes since 2024.2 . Removing
support for Python 3.8 allows us to replace deprecated md5 wrapper from
oslo.utils [1] by direct call of hashlib.md5.

[1] https://review.opendev.org/c/openstack/oslo.utils/+/930879

Also add python 3.12 to classifiers because now py312 unit test job is
voting.

Change-Id: I53da305538e27f2ff20a1ecb25960ebb03388011
This commit is contained in:
Takashi Kajinami 2024-10-02 02:25:49 +09:00
parent 1ecab6dbc5
commit 91596bef6b
6 changed files with 15 additions and 10 deletions

View File

@ -21,6 +21,7 @@ Includes root and intermediate CAs, SSH key_pairs and x509 certificates.
import base64
import binascii
import hashlib
import io
import os
import typing as ty
@ -36,7 +37,6 @@ from cryptography import x509
from oslo_concurrency import processutils
from oslo_log import log as logging
from oslo_serialization import base64 as oslo_base64
from oslo_utils.secretutils import md5
import paramiko
import nova.conf
@ -75,7 +75,7 @@ def generate_fingerprint(public_key: str) -> str:
serialization.load_ssh_public_key(
pub_bytes, backends.default_backend())
pub_data = base64.b64decode(public_key.split(' ')[1])
raw_fp = md5(pub_data, usedforsecurity=False).hexdigest()
raw_fp = hashlib.md5(pub_data, usedforsecurity=False).hexdigest()
return ':'.join(a + b for a, b in zip(raw_fp[::2], raw_fp[1::2]))
except Exception:
raise exception.InvalidKeypair(

View File

@ -17,9 +17,10 @@
Helpers for filesystem related routines.
"""
import hashlib
from oslo_concurrency import processutils
from oslo_log import log as logging
from oslo_utils.secretutils import md5
import nova.privsep
@ -283,7 +284,7 @@ def _get_hash_str(base_str):
"""
if isinstance(base_str, str):
base_str = base_str.encode('utf-8')
return md5(base_str, usedforsecurity=False).hexdigest()
return hashlib.md5(base_str, usedforsecurity=False).hexdigest()
def get_file_extension_for_os_type(os_type, default_ephemeral_format,

View File

@ -13,6 +13,7 @@
# under the License.
import datetime
import hashlib
import os
import os.path
import tempfile
@ -29,7 +30,6 @@ from oslo_context import context as common_context
from oslo_context import fixture as context_fixture
from oslo_utils import encodeutils
from oslo_utils import fixture as utils_fixture
from oslo_utils.secretutils import md5
from nova import context
from nova import exception
@ -203,7 +203,7 @@ class GenericUtilsTestCase(test.NoDBTestCase):
def test_get_hash_str(self):
base_str = b"foo"
base_unicode = u"foo"
value = md5(base_str, usedforsecurity=False).hexdigest()
value = hashlib.md5(base_str, usedforsecurity=False).hexdigest()
self.assertEqual(
value, utils.get_hash_str(base_str))
self.assertEqual(

View File

@ -44,7 +44,6 @@ import oslo_messaging as messaging
from oslo_utils import encodeutils
from oslo_utils import excutils
from oslo_utils import importutils
from oslo_utils.secretutils import md5
from oslo_utils import strutils
from oslo_utils import timeutils
@ -791,7 +790,7 @@ def get_hash_str(base_str):
"""
if isinstance(base_str, str):
base_str = base_str.encode('utf-8')
return md5(base_str, usedforsecurity=False).hexdigest()
return hashlib.md5(base_str, usedforsecurity=False).hexdigest()
def get_sha256_str(base_str):

View File

@ -0,0 +1,5 @@
---
upgrade:
- |
Support for Python 3.8 has been removed. Now the minimum python version
supported is 3.9 .

View File

@ -10,7 +10,7 @@ project_urls =
Bug Tracker = https://bugs.launchpad.net/nova/
Documentation = https://docs.openstack.org/nova/
Source Code = https://opendev.org/openstack/nova
python_requires = >=3.8
python_requires = >=3.9
classifiers =
Development Status :: 5 - Production/Stable
Environment :: OpenStack
@ -20,10 +20,10 @@ classifiers =
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: Implementation :: CPython