summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIndrajit Raychaudhuri <irc@indrajit.com>2025-01-22 01:42:33 -0600
committerIndrajit Raychaudhuri <irc@indrajit.com>2025-01-26 12:31:31 -0600
commite8e05f87e5c23eb59d7895ff50e90f3d3e60e2f1 (patch)
tree60c5c571d6529c47a82e28835d7807d578aa3225 /src
parent529c24a9d550b30ba7fabcbae3a5bc0d5d35c647 (diff)
downloadvyos-1x-e8e05f87e5c23eb59d7895ff50e90f3d3e60e2f1.tar.gz
vyos-1x-e8e05f87e5c23eb59d7895ff50e90f3d3e60e2f1.zip
T6998: Remove vestigial helper and reformat
Diffstat (limited to 'src')
-rwxr-xr-xsrc/op_mode/dhcp.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/op_mode/dhcp.py b/src/op_mode/dhcp.py
index 7091808e0..8eed2c6cd 100755
--- a/src/op_mode/dhcp.py
+++ b/src/op_mode/dhcp.py
@@ -82,12 +82,6 @@ ArgState = typing.Literal[
ArgOrigin = typing.Literal['local', 'remote']
-def _utc_to_local(utc_dt):
- return datetime.fromtimestamp(
- (datetime.fromtimestamp(utc_dt) - datetime(1970, 1, 1)).total_seconds()
- )
-
-
def _get_raw_server_leases(
config, family='inet', pool=None, sorted=None, state=[], origin=None
) -> list:
@@ -112,7 +106,11 @@ def _get_formatted_server_leases(raw_data, family='inet'):
hw_addr = lease.get('mac')
state = lease.get('state')
start = datetime.fromtimestamp(lease.get('start'), timezone.utc)
- end = datetime.fromtimestamp(lease.get('end'), timezone.utc) if lease.get('end') else '-'
+ end = (
+ datetime.fromtimestamp(lease.get('end'), timezone.utc)
+ if lease.get('end')
+ else '-'
+ )
remain = lease.get('remaining')
pool = lease.get('pool')
hostname = lease.get('hostname')
@@ -137,8 +135,14 @@ def _get_formatted_server_leases(raw_data, family='inet'):
for lease in raw_data:
ipaddr = lease.get('ip')
state = lease.get('state')
- start = datetime.fromtimestamp(lease.get('last_communication'), timezone.utc)
- end = datetime.fromtimestamp(lease.get('end'), timezone.utc) if lease.get('end') else '-'
+ start = datetime.fromtimestamp(
+ lease.get('last_communication'), timezone.utc
+ )
+ end = (
+ datetime.fromtimestamp(lease.get('end'), timezone.utc)
+ if lease.get('end')
+ else '-'
+ )
remain = lease.get('remaining')
lease_type = lease.get('type')
pool = lease.get('pool')