Remove python 3.8 support
Python 3.8 is no longer be 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 Change-Id: Ibe2a4edf8cd6943932a46a8edbcf9587461dbb79
This commit is contained in:
parent
13acba7505
commit
0e7ce177a5
@ -18,7 +18,6 @@ import glance_store as store
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import encodeutils
|
||||
from oslo_utils import secretutils
|
||||
from taskflow.patterns import linear_flow as lf
|
||||
from taskflow import retry
|
||||
from taskflow import task
|
||||
@ -60,7 +59,7 @@ class _CalculateHash(task.Task):
|
||||
|
||||
def _calculate_hash(self, image):
|
||||
current_os_hash_value = hashlib.new(self.hashing_algo)
|
||||
current_checksum = secretutils.md5(usedforsecurity=False)
|
||||
current_checksum = hashlib.md5(usedforsecurity=False)
|
||||
for chunk in image.get_data():
|
||||
if chunk is None:
|
||||
break
|
||||
|
@ -16,13 +16,13 @@
|
||||
"""
|
||||
LRU Cache for Image Data
|
||||
"""
|
||||
import hashlib
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
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 units
|
||||
|
||||
from glance.common import exception
|
||||
@ -354,7 +354,7 @@ class ImageCache(object):
|
||||
|
||||
def cache_tee_iter(self, image_id, image_iter, image_checksum):
|
||||
try:
|
||||
current_checksum = md5(usedforsecurity=False)
|
||||
current_checksum = hashlib.md5(usedforsecurity=False)
|
||||
|
||||
with self.driver.open_for_write(image_id) as cache_file:
|
||||
for chunk in image_iter:
|
||||
|
@ -29,7 +29,6 @@ from oslo_config import cfg
|
||||
from oslo_limit import exception as ol_exc
|
||||
from oslo_limit import limit
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils.secretutils import md5
|
||||
from oslo_utils import units
|
||||
import requests
|
||||
|
||||
@ -212,7 +211,8 @@ class TestImages(functional.FunctionalTest):
|
||||
status='active',
|
||||
max_sec=10,
|
||||
delay_sec=0.2)
|
||||
expect_c = str(md5(image_data, usedforsecurity=False).hexdigest())
|
||||
expect_c = str(
|
||||
hashlib.md5(image_data, usedforsecurity=False).hexdigest())
|
||||
expect_h = str(hashlib.sha512(image_data).hexdigest())
|
||||
func_utils.verify_image_hashes_and_status(self,
|
||||
image_id,
|
||||
@ -355,7 +355,8 @@ class TestImages(functional.FunctionalTest):
|
||||
delay_sec=0.2,
|
||||
start_delay_sec=1)
|
||||
with requests.get(image_data_uri) as r:
|
||||
expect_c = str(md5(r.content, usedforsecurity=False).hexdigest())
|
||||
expect_c = str(
|
||||
hashlib.md5(r.content, usedforsecurity=False).hexdigest())
|
||||
expect_h = str(hashlib.sha512(r.content).hexdigest())
|
||||
func_utils.verify_image_hashes_and_status(self,
|
||||
image_id,
|
||||
@ -733,7 +734,8 @@ class TestImages(functional.FunctionalTest):
|
||||
response = requests.put(path, headers=headers, data=image_data)
|
||||
self.assertEqual(http.NO_CONTENT, response.status_code)
|
||||
|
||||
expect_c = str(md5(image_data, usedforsecurity=False).hexdigest())
|
||||
expect_c = str(
|
||||
hashlib.md5(image_data, usedforsecurity=False).hexdigest())
|
||||
expect_h = str(hashlib.sha512(image_data).hexdigest())
|
||||
func_utils.verify_image_hashes_and_status(self, image_id, expect_c,
|
||||
expect_h, 'active',
|
||||
@ -1176,7 +1178,8 @@ class TestImages(functional.FunctionalTest):
|
||||
image_data = b'ZZZZZ'
|
||||
response = requests.put(path, headers=headers, data=image_data)
|
||||
self.assertEqual(http.NO_CONTENT, response.status_code)
|
||||
expect_c = str(md5(image_data, usedforsecurity=False).hexdigest())
|
||||
expect_c = str(
|
||||
hashlib.md5(image_data, usedforsecurity=False).hexdigest())
|
||||
expect_h = str(hashlib.sha512(image_data).hexdigest())
|
||||
func_utils.verify_image_hashes_and_status(self,
|
||||
image_id,
|
||||
@ -1190,7 +1193,8 @@ class TestImages(functional.FunctionalTest):
|
||||
image_data = b'WWWWW'
|
||||
response = requests.put(path, headers=headers, data=image_data)
|
||||
self.assertEqual(http.NO_CONTENT, response.status_code)
|
||||
expect_c = str(md5(image_data, usedforsecurity=False).hexdigest())
|
||||
expect_c = str(
|
||||
hashlib.md5(image_data, usedforsecurity=False).hexdigest())
|
||||
expect_h = str(hashlib.sha512(image_data).hexdigest())
|
||||
func_utils.verify_image_hashes_and_status(self,
|
||||
image2_id,
|
||||
@ -3793,7 +3797,8 @@ class TestImages(functional.FunctionalTest):
|
||||
headers = self._headers({'X-Tenant-Id': TENANT1})
|
||||
url = 'http://127.0.0.1:%s/foo_image' % self.http_port0
|
||||
with requests.get(url) as r:
|
||||
expect_c = str(md5(r.content, usedforsecurity=False).hexdigest())
|
||||
expect_c = str(
|
||||
hashlib.md5(r.content, usedforsecurity=False).hexdigest())
|
||||
expect_h = str(hashlib.sha256(r.content).hexdigest())
|
||||
validation_data = {
|
||||
'os_hash_algo': 'sha256',
|
||||
@ -3835,7 +3840,8 @@ class TestImages(functional.FunctionalTest):
|
||||
url = 'http://127.0.0.1:%s/foo_image' % self.http_port0
|
||||
|
||||
with requests.get(url) as r:
|
||||
expect_c = str(md5(r.content, usedforsecurity=False).hexdigest())
|
||||
expect_c = str(
|
||||
hashlib.md5(r.content, usedforsecurity=False).hexdigest())
|
||||
expect_h = str(hashlib.sha512(r.content).hexdigest())
|
||||
validation_data = {
|
||||
'os_hash_algo': 'sha512',
|
||||
@ -3882,7 +3888,8 @@ class TestImages(functional.FunctionalTest):
|
||||
headers = self._headers({'X-Tenant-Id': TENANT1})
|
||||
url = 'http://127.0.0.1:%s/foo_image' % self.http_port0
|
||||
with requests.get(url) as r:
|
||||
expect_c = str(md5(r.content, usedforsecurity=False).hexdigest())
|
||||
expect_c = str(
|
||||
hashlib.md5(r.content, usedforsecurity=False).hexdigest())
|
||||
expect_h = str(hashlib.sha512(r.content).hexdigest())
|
||||
data = jsonutils.dumps({'url': url})
|
||||
response = requests.post(path, headers=headers, data=data)
|
||||
@ -4056,7 +4063,8 @@ class TestImages(functional.FunctionalTest):
|
||||
response = requests.put(path, headers=headers, data=image_data)
|
||||
self.assertEqual(http.NO_CONTENT, response.status_code)
|
||||
|
||||
expect_c = str(md5(image_data, usedforsecurity=False).hexdigest())
|
||||
expect_c = str(
|
||||
hashlib.md5(image_data, usedforsecurity=False).hexdigest())
|
||||
expect_h = str(hashlib.sha512(image_data).hexdigest())
|
||||
func_utils.verify_image_hashes_and_status(self, image_id, expect_c,
|
||||
expect_h, 'active',
|
||||
@ -5029,7 +5037,8 @@ class TestImagesMultipleBackend(functional.MultipleBackendFunctionalTest):
|
||||
status='active',
|
||||
max_sec=15,
|
||||
delay_sec=0.2)
|
||||
expect_c = str(md5(image_data, usedforsecurity=False).hexdigest())
|
||||
expect_c = str(
|
||||
hashlib.md5(image_data, usedforsecurity=False).hexdigest())
|
||||
expect_h = str(hashlib.sha512(image_data).hexdigest())
|
||||
func_utils.verify_image_hashes_and_status(self,
|
||||
image_id,
|
||||
@ -5194,7 +5203,8 @@ class TestImagesMultipleBackend(functional.MultipleBackendFunctionalTest):
|
||||
status='active',
|
||||
max_sec=15,
|
||||
delay_sec=0.2)
|
||||
expect_c = str(md5(image_data, usedforsecurity=False).hexdigest())
|
||||
expect_c = str(
|
||||
hashlib.md5(image_data, usedforsecurity=False).hexdigest())
|
||||
expect_h = str(hashlib.sha512(image_data).hexdigest())
|
||||
func_utils.verify_image_hashes_and_status(self,
|
||||
image_id,
|
||||
@ -5358,7 +5368,8 @@ class TestImagesMultipleBackend(functional.MultipleBackendFunctionalTest):
|
||||
delay_sec=0.2,
|
||||
start_delay_sec=1)
|
||||
with requests.get(image_data_uri) as r:
|
||||
expect_c = str(md5(r.content, usedforsecurity=False).hexdigest())
|
||||
expect_c = str(
|
||||
hashlib.md5(r.content, usedforsecurity=False).hexdigest())
|
||||
expect_h = str(hashlib.sha512(r.content).hexdigest())
|
||||
func_utils.verify_image_hashes_and_status(self,
|
||||
image_id,
|
||||
@ -5521,7 +5532,8 @@ class TestImagesMultipleBackend(functional.MultipleBackendFunctionalTest):
|
||||
delay_sec=0.2,
|
||||
start_delay_sec=1)
|
||||
with requests.get(image_data_uri) as r:
|
||||
expect_c = str(md5(r.content, usedforsecurity=False).hexdigest())
|
||||
expect_c = str(
|
||||
hashlib.md5(r.content, usedforsecurity=False).hexdigest())
|
||||
expect_h = str(hashlib.sha512(r.content).hexdigest())
|
||||
func_utils.verify_image_hashes_and_status(self,
|
||||
image_id,
|
||||
@ -5683,7 +5695,8 @@ class TestImagesMultipleBackend(functional.MultipleBackendFunctionalTest):
|
||||
delay_sec=0.2,
|
||||
start_delay_sec=1)
|
||||
with requests.get(image_data_uri) as r:
|
||||
expect_c = str(md5(r.content, usedforsecurity=False).hexdigest())
|
||||
expect_c = str(
|
||||
hashlib.md5(r.content, usedforsecurity=False).hexdigest())
|
||||
expect_h = str(hashlib.sha512(r.content).hexdigest())
|
||||
func_utils.verify_image_hashes_and_status(self,
|
||||
image_id,
|
||||
@ -5847,7 +5860,8 @@ class TestImagesMultipleBackend(functional.MultipleBackendFunctionalTest):
|
||||
delay_sec=0.2,
|
||||
start_delay_sec=1)
|
||||
with requests.get(image_data_uri) as r:
|
||||
expect_c = str(md5(r.content, usedforsecurity=False).hexdigest())
|
||||
expect_c = str(
|
||||
hashlib.md5(r.content, usedforsecurity=False).hexdigest())
|
||||
expect_h = str(hashlib.sha512(r.content).hexdigest())
|
||||
func_utils.verify_image_hashes_and_status(self,
|
||||
image_id,
|
||||
@ -6071,7 +6085,8 @@ class TestImagesMultipleBackend(functional.MultipleBackendFunctionalTest):
|
||||
delay_sec=0.2,
|
||||
start_delay_sec=1)
|
||||
with requests.get(image_data_uri) as r:
|
||||
expect_c = str(md5(r.content, usedforsecurity=False).hexdigest())
|
||||
expect_c = str(
|
||||
hashlib.md5(r.content, usedforsecurity=False).hexdigest())
|
||||
expect_h = str(hashlib.sha512(r.content).hexdigest())
|
||||
func_utils.verify_image_hashes_and_status(self,
|
||||
image_id,
|
||||
@ -6329,7 +6344,8 @@ class TestImagesMultipleBackend(functional.MultipleBackendFunctionalTest):
|
||||
delay_sec=0.2,
|
||||
start_delay_sec=1)
|
||||
with requests.get(image_data_uri) as r:
|
||||
expect_c = str(md5(r.content, usedforsecurity=False).hexdigest())
|
||||
expect_c = str(
|
||||
hashlib.md5(r.content, usedforsecurity=False).hexdigest())
|
||||
expect_h = str(hashlib.sha512(r.content).hexdigest())
|
||||
func_utils.verify_image_hashes_and_status(self,
|
||||
image_id,
|
||||
@ -6471,7 +6487,8 @@ class TestImagesMultipleBackend(functional.MultipleBackendFunctionalTest):
|
||||
response = requests.put(path, headers=headers, data=image_data)
|
||||
self.assertEqual(http.NO_CONTENT, response.status_code)
|
||||
|
||||
expect_c = str(md5(image_data, usedforsecurity=False).hexdigest())
|
||||
expect_c = str(
|
||||
hashlib.md5(image_data, usedforsecurity=False).hexdigest())
|
||||
expect_h = str(hashlib.sha512(image_data).hexdigest())
|
||||
func_utils.verify_image_hashes_and_status(self,
|
||||
image_id,
|
||||
@ -6645,7 +6662,8 @@ class TestImagesMultipleBackend(functional.MultipleBackendFunctionalTest):
|
||||
response = requests.put(path, headers=headers, data=image_data)
|
||||
self.assertEqual(http.NO_CONTENT, response.status_code)
|
||||
|
||||
expect_c = str(md5(image_data, usedforsecurity=False).hexdigest())
|
||||
expect_c = str(
|
||||
hashlib.md5(image_data, usedforsecurity=False).hexdigest())
|
||||
expect_h = str(hashlib.sha512(image_data).hexdigest())
|
||||
func_utils.verify_image_hashes_and_status(self,
|
||||
image_id,
|
||||
@ -7181,7 +7199,8 @@ class TestCopyImagePermissions(functional.MultipleBackendFunctionalTest):
|
||||
delay_sec=0.2,
|
||||
start_delay_sec=1)
|
||||
with requests.get(image_data_uri) as r:
|
||||
expect_c = str(md5(r.content, usedforsecurity=False).hexdigest())
|
||||
expect_c = str(
|
||||
hashlib.md5(r.content, usedforsecurity=False).hexdigest())
|
||||
expect_h = str(hashlib.sha512(r.content).hexdigest())
|
||||
func_utils.verify_image_hashes_and_status(self,
|
||||
image_id,
|
||||
@ -7942,7 +7961,8 @@ class TestMultipleBackendsLocationApi(functional.SynchronousAPIBase):
|
||||
headers = self._headers({'X-Tenant-Id': TENANT1})
|
||||
url = 'http://127.0.0.1:%s/store1/foo_image' % self.http_port0
|
||||
with requests.get(url) as r:
|
||||
expect_c = str(md5(r.content, usedforsecurity=False).hexdigest())
|
||||
expect_c = str(
|
||||
hashlib.md5(r.content, usedforsecurity=False).hexdigest())
|
||||
expect_h = str(hashlib.sha256(r.content).hexdigest())
|
||||
validation_data = {
|
||||
'os_hash_algo': 'sha256',
|
||||
@ -7984,7 +8004,8 @@ class TestMultipleBackendsLocationApi(functional.SynchronousAPIBase):
|
||||
url = 'http://127.0.0.1:%s/store2/foo_image' % self.http_port0
|
||||
|
||||
with requests.get(url) as r:
|
||||
expect_c = str(md5(r.content, usedforsecurity=False).hexdigest())
|
||||
expect_c = str(
|
||||
hashlib.md5(r.content, usedforsecurity=False).hexdigest())
|
||||
expect_h = str(hashlib.sha512(r.content).hexdigest())
|
||||
validation_data = {
|
||||
'os_hash_algo': 'sha512',
|
||||
@ -8032,7 +8053,8 @@ class TestMultipleBackendsLocationApi(functional.SynchronousAPIBase):
|
||||
headers = self._headers({'X-Tenant-Id': TENANT1})
|
||||
url = 'http://127.0.0.1:%s/store2/foo_image' % self.http_port0
|
||||
with requests.get(url) as r:
|
||||
expect_c = str(md5(r.content, usedforsecurity=False).hexdigest())
|
||||
expect_c = str(
|
||||
hashlib.md5(r.content, usedforsecurity=False).hexdigest())
|
||||
expect_h = str(hashlib.sha512(r.content).hexdigest())
|
||||
data = {'url': url}
|
||||
response = self.api_post(path, headers=headers, json=data)
|
||||
|
@ -16,6 +16,7 @@
|
||||
from contextlib import contextmanager
|
||||
import datetime
|
||||
import errno
|
||||
import hashlib
|
||||
import io
|
||||
import os
|
||||
import tempfile
|
||||
@ -26,7 +27,6 @@ import fixtures
|
||||
import glance_store as store
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import fileutils
|
||||
from oslo_utils import secretutils
|
||||
from oslo_utils import units
|
||||
|
||||
from glance import async_
|
||||
@ -476,7 +476,7 @@ class ImageCacheTestCase(object):
|
||||
image = b"12345678990abcdefghijklmnop"
|
||||
image_id = 123
|
||||
|
||||
md5 = secretutils.md5(usedforsecurity=False)
|
||||
md5 = hashlib.md5(usedforsecurity=False)
|
||||
md5.update(image)
|
||||
checksum = md5.hexdigest()
|
||||
|
||||
|
5
releasenotes/notes/remove-py38-0d208cda61f2e0a7.yaml
Normal file
5
releasenotes/notes/remove-py38-0d208cda61f2e0a7.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
Support for Python 3.8 has been removed. Now the minimum python version
|
||||
supported is 3.9 .
|
@ -6,7 +6,7 @@ description_file =
|
||||
author = OpenStack
|
||||
author_email = openstack-discuss@lists.openstack.org
|
||||
home_page = https://docs.openstack.org/glance/latest/
|
||||
python_requires = >=3.8
|
||||
python_requires = >=3.9
|
||||
classifier =
|
||||
Environment :: OpenStack
|
||||
Intended Audience :: Information Technology
|
||||
@ -16,7 +16,6 @@ classifier =
|
||||
Programming Language :: Python
|
||||
Programming Language :: Python :: 3 :: Only
|
||||
Programming Language :: Python :: 3
|
||||
Programming Language :: Python :: 3.8
|
||||
Programming Language :: Python :: 3.9
|
||||
Programming Language :: Python :: 3.10
|
||||
Programming Language :: Python :: 3.11
|
||||
|
Loading…
x
Reference in New Issue
Block a user