diff --git a/nova/crypto.py b/nova/crypto.py index 3b358a3e1626..44aeef2fa94f 100644 --- a/nova/crypto.py +++ b/nova/crypto.py @@ -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( diff --git a/nova/privsep/fs.py b/nova/privsep/fs.py index 11249322a44d..0ba25ca85299 100644 --- a/nova/privsep/fs.py +++ b/nova/privsep/fs.py @@ -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, diff --git a/nova/tests/unit/test_utils.py b/nova/tests/unit/test_utils.py index f3ddd9d52b69..f6372ce450d7 100644 --- a/nova/tests/unit/test_utils.py +++ b/nova/tests/unit/test_utils.py @@ -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( diff --git a/nova/utils.py b/nova/utils.py index 777a188637ab..52ee35c2d686 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -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): diff --git a/releasenotes/notes/remove-py38-5c619aee267bc1f3.yaml b/releasenotes/notes/remove-py38-5c619aee267bc1f3.yaml new file mode 100644 index 000000000000..04031636056b --- /dev/null +++ b/releasenotes/notes/remove-py38-5c619aee267bc1f3.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - | + Support for Python 3.8 has been removed. Now the minimum python version + supported is 3.9 . diff --git a/setup.cfg b/setup.cfg index 8d323280faa4..1b878af09122 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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