Replace pytz by built-in datetime module

... to reduce external dependency.

Change-Id: I6005942ec4af5fc01f60c5a4ed52c39548d79367
This commit is contained in:
Takashi Kajinami 2024-06-10 18:02:37 +09:00
parent 2c2bb5e6c1
commit 8b2dbb5dd9
2 changed files with 2 additions and 4 deletions

View File

@ -14,7 +14,6 @@
import datetime import datetime
import os import os
import pytz
from oslo_log import log as oslo_logging from oslo_log import log as oslo_logging
@ -70,11 +69,11 @@ class UsersPlugin(base.BaseCloudConfigPlugin):
if isinstance(expiredate, str): if isinstance(expiredate, str):
year, month, day = map(int, expiredate.split('-')) year, month, day = map(int, expiredate.split('-'))
expiredate = datetime.datetime(year=year, month=month, day=day, expiredate = datetime.datetime(year=year, month=month, day=day,
tzinfo=pytz.utc) tzinfo=datetime.timezone.utc)
# Py2.7 does not support timestamps, this is the # Py2.7 does not support timestamps, this is the
# only way to compute the seconds passed since the unix epoch # only way to compute the seconds passed since the unix epoch
unix_time = datetime.datetime(year=1970, month=1, day=1, unix_time = datetime.datetime(year=1970, month=1, day=1,
tzinfo=pytz.utc) tzinfo=datetime.timezone.utc)
expire_interval = (expiredate - unix_time).total_seconds() expire_interval = (expiredate - unix_time).total_seconds()
return expire_interval return expire_interval

View File

@ -7,7 +7,6 @@ oslo.log
Babel>=1.3 Babel>=1.3
oauthlib oauthlib
netifaces netifaces
pytz
PyYAML PyYAML
requests requests
untangle==1.2.1 untangle==1.2.1