Replace deprecated datetime.utcnow()
The datetime.utcnow() is deprecated in Python 3.12. Replace datetime.utcnow() with datetime.now(datetime.timezone.utc).replace(tzinfo=None). Change-Id: Ic20174a9c6cacac05471fa57b105c1f784a73057 Signed-off-by: Takashi Natsume <takanattie@gmail.com>
This commit is contained in:
parent
8890981491
commit
fb1f841d2d
@ -153,7 +153,7 @@ class ListUsage(command.Lister):
|
||||
)
|
||||
|
||||
date_cli_format = "%Y-%m-%d"
|
||||
now = datetime.datetime.utcnow()
|
||||
now = datetime.datetime.now(datetime.timezone.utc).replace(tzinfo=None)
|
||||
|
||||
if parsed_args.start:
|
||||
start = datetime.datetime.strptime(
|
||||
@ -238,7 +238,7 @@ class ShowUsage(command.ShowOne):
|
||||
identity_client = self.app.client_manager.identity
|
||||
compute_client = self.app.client_manager.sdk_connection.compute
|
||||
date_cli_format = "%Y-%m-%d"
|
||||
now = datetime.datetime.utcnow()
|
||||
now = datetime.datetime.now(datetime.timezone.utc).replace(tzinfo=None)
|
||||
|
||||
if parsed_args.start:
|
||||
start = datetime.datetime.strptime(
|
||||
|
@ -107,7 +107,8 @@ class ApplicationCredentialTests(common.IdentityTests):
|
||||
secret = data_utils.rand_name('secret')
|
||||
description = data_utils.rand_name('description')
|
||||
tomorrow = (
|
||||
datetime.datetime.utcnow() + datetime.timedelta(days=1)
|
||||
datetime.datetime.now(datetime.timezone.utc).replace(tzinfo=None)
|
||||
+ datetime.timedelta(days=1)
|
||||
).strftime('%Y-%m-%dT%H:%M:%S%z')
|
||||
role1, role2 = self._create_role_assignments()
|
||||
raw_output = self.openstack(
|
||||
|
Loading…
Reference in New Issue
Block a user