From 493e3bec1e708aa9328c17d7f5fc07bb66044b7d Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Mon, 13 Apr 2026 22:55:13 -0500 Subject: dhcp: T8493: Fix sort ordering for remaining time display Op mode command `show dhcp server leases sort remaining` should sort leases by remaining time in timedelta form, not string form. --- python/vyos/kea.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'python') diff --git a/python/vyos/kea.py b/python/vyos/kea.py index 703dd8b49..2ebf1339a 100644 --- a/python/vyos/kea.py +++ b/python/vyos/kea.py @@ -661,7 +661,7 @@ def kea_get_server_leases(config, inet, vrf_name, pools=[], state=[], origin=Non if lease['valid-lft'] > 0 and lease['expire_time'] > now: # subtraction gives us a timedelta object which can't be formatted # with strftime so we use str(), split gets rid of the microseconds - data_lease['remaining'] = str(lease['expire_time'] - now).split('.')[0] + data_lease['remaining'] = (lease['expire_time'].replace(microsecond=0) - now.replace(microsecond=0)) # Do not add old leases if ( -- cgit v1.2.3