From 1ccfbf1fa84a2bf90dcc09139b962e3ef49bbff4 Mon Sep 17 00:00:00 2001 From: Nicolas Vandamme Date: Wed, 8 Jan 2025 12:40:34 +0100 Subject: [PATCH] dhcpv6-server: T5992: Fix op-mode Kea DHCP lease output, migration from deprectaed utcfromtimestamp to fromtimestamp --- src/op_mode/dhcp.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/op_mode/dhcp.py b/src/op_mode/dhcp.py index 20f54df25c..11e4926554 100755 --- a/src/op_mode/dhcp.py +++ b/src/op_mode/dhcp.py @@ -101,8 +101,8 @@ def _get_raw_server_leases(family='inet', pool=None, sorted=None, state=[], orig lifetime = lease['valid-lft'] expiry = (lease['cltt'] + lifetime) - lease['start_timestamp'] = datetime.fromtimestamp(expiry - lifetime, timezone.utc) - lease['expire_timestamp'] = datetime.fromtimestamp(expiry, timezone.utc) if expiry else None + lease['start_timestamp'] = datetime.fromtimestamp(expiry - lifetime, tz=timezone.utc) + lease['expire_timestamp'] = datetime.fromtimestamp(expiry, tz=timezone.utc) if expiry else None data_lease = {} data_lease['ip'] = lease['ip-address'] @@ -132,7 +132,7 @@ def _get_raw_server_leases(family='inet', pool=None, sorted=None, state=[], orig data_lease['remaining'] = '-' if lease['valid-lft'] > 0: - data_lease['remaining'] = lease['expire_timestamp'] - datetime.now(timezone.utc) + data_lease['remaining'] = lease['expire_timestamp'] - datetime.now(tz=timezone.utc) if data_lease['remaining'].days >= 0: # substraction gives us a timedelta object which can't be formatted with strftime