Remove Python 3.8 support

Python 3.8 is no longer part of the tested runtimes for 2024.2[1]
because its EOL is coming soon.

[1] https://governance.openstack.org/tc/reference/runtimes/2024.2.html

Change-Id: I3e9ba41b542ea6309a7415337f60fd37bc9adebc
This commit is contained in:
Takashi Kajinami 2024-06-25 11:18:49 +09:00
parent f43e903117
commit 88c2fd905a
6 changed files with 15 additions and 44 deletions

View File

@ -21,6 +21,7 @@
import datetime
import itertools
import json
import zoneinfo
import croniter
from oslo_config import cfg
@ -36,14 +37,6 @@ import wsme
from wsme import types as wtypes
import wsmeext.pecan as wsme_pecan
try:
import zoneinfo
except ImportError:
# zoneinfo is available in Python >= 3.9
import pytz
import pytz.exceptions
zoneinfo = None
import aodh
from aodh.api.controllers.v2 import base
from aodh.api.controllers.v2 import utils as v2_utils
@ -182,12 +175,9 @@ class AlarmTimeConstraint(base.Base):
@staticmethod
def validate(tc):
if tc.timezone:
checker = zoneinfo.ZoneInfo if zoneinfo else pytz.timezone
exc = (zoneinfo.ZoneInfoNotFoundError if zoneinfo else
pytz.exceptions.UnknownTimeZoneError)
try:
checker(tc.timezone)
except exc:
zoneinfo.ZoneInfo(tc.timezone)
except zoneinfo.ZoneInfoNotFoundError:
raise base.ClientSideError(_("Timezone %s is not valid")
% tc.timezone)
return tc

View File

@ -18,6 +18,7 @@ import abc
import datetime
import json
import threading
import zoneinfo
from concurrent import futures
import cotyledon
@ -29,13 +30,6 @@ from oslo_utils import timeutils
from oslo_utils import uuidutils
from stevedore import extension
try:
import zoneinfo
except ImportError:
# zoneinfo is available in Python >= 3.9
import pytz
zoneinfo = None
import aodh
from aodh import coordination
from aodh import keystone_client
@ -156,11 +150,7 @@ class Evaluator(object, metaclass=abc.ABCMeta):
now_utc = timeutils.utcnow().replace(tzinfo=datetime.timezone.utc)
for tc in alarm.time_constraints:
if zoneinfo:
tz = (zoneinfo.ZoneInfo(tc['timezone'])
if tc['timezone'] else None)
else:
tz = pytz.timezone(tc['timezone']) if tc['timezone'] else None
tz = zoneinfo.ZoneInfo(tc['timezone']) if tc['timezone'] else None
now_tz = now_utc.astimezone(tz) if tz else now_utc
start_cron = croniter.croniter(tc['start'], now_tz)
if cls._is_exact_match(start_cron, now_tz):

View File

@ -18,18 +18,12 @@ import datetime
import fixtures
import json
from unittest import mock
import zoneinfo
from gnocchiclient import exceptions
from oslo_utils import timeutils
from oslo_utils import uuidutils
try:
import zoneinfo
except ImportError:
# zoneinfo is available in Python >= 3.9
import pytz
zoneinfo = None
from aodh.evaluator import gnocchi
from aodh import messaging
from aodh.storage import models
@ -357,10 +351,7 @@ class TestGnocchiResourceThresholdEvaluate(TestGnocchiEvaluatorBase):
'duration': 10800, # 3 hours
'timezone': 'Europe/Ljubljana'}
]
if zoneinfo:
tzinfo = zoneinfo.ZoneInfo('Europe/Ljubljana')
else:
tzinfo = pytz.timezone('Europe/Ljubljana')
tzinfo = zoneinfo.ZoneInfo('Europe/Ljubljana')
dt = datetime.datetime(2014, 1, 1, 15, 0, 0, tzinfo=tzinfo)
mock_utcnow.return_value = dt.astimezone(datetime.timezone.utc)
self.client.metric.get_measures.return_value = []
@ -382,10 +373,7 @@ class TestGnocchiResourceThresholdEvaluate(TestGnocchiEvaluatorBase):
'duration': 10800, # 3 hours
'timezone': 'Europe/Ljubljana'}
]
if zoneinfo:
tzinfo = zoneinfo.ZoneInfo('Europe/Ljubljana')
else:
tzinfo = pytz.timezone('Europe/Ljubljana')
tzinfo = zoneinfo.ZoneInfo('Europe/Ljubljana')
dt = datetime.datetime(2014, 1, 1, 12, 0, 0, tzinfo=tzinfo)
mock_utcnow.return_value = dt.astimezone(datetime.timezone.utc)
self.client.metric.get_measures.return_value = []

View File

@ -0,0 +1,5 @@
---
upgrade:
- |
Python 3.8 support was dropped. The minimum version of Python now supported
is Python 3.9.

View File

@ -19,7 +19,6 @@ oslo.messaging>=5.2.0 # Apache-2.0
oslo.middleware>=3.22.0 # Apache-2.0
oslo.utils>=4.7.0 # Apache-2.0
python-keystoneclient>=1.6.0
pytz>=2013.6;python_version<"3.9" # MIT
requests>=2.5.2
stevedore>=1.5.0 # Apache-2.0
SQLAlchemy>=1.4.1
@ -34,4 +33,4 @@ python-observabilityclient>=0.0.4
python-octaviaclient>=1.8.0
python-dateutil>=2.8.2 # BSD
python-heatclient>=1.17.0
tzdata>=2022.4;python_version>="3.9" # MIT
tzdata>=2022.4

View File

@ -7,7 +7,7 @@ description_file =
author = OpenStack
author_email = openstack-discuss@lists.openstack.org
home_page = https://docs.openstack.org/aodh/latest/
python_requires = >=3.8
python_requires = >=3.9
classifier =
Environment :: OpenStack
Intended Audience :: Information Technology
@ -18,7 +18,6 @@ classifier =
Programming Language :: Python :: Implementation :: CPython
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