statd: fix double timezone in DHCP lease expiry timestamps

The isoformat() method already includes the timezone offset when the
datetime object has timezone info.  Appending "+00:00" created an
invalid double-timezone suffix like "2025-11-30T13:13:49+00:00+00:00"
which failed YANG validation.

Error was:
  admin@bpi-26-60-00:/> show dhcp-server
  Error running sysrepocfg: Command '['sysrepocfg', '-f', 'json', '-X',
  '-d', 'operational', '-x', '/infix-dhcp-server:dhcp-server']' returned
  non-zero exit status 1.
  No interface data retrieved.

With syslog showing:
  statd[4291]: libyang[0]: Invalid union value
  "2025-11-30T13:13:49+00:00+00:00" - no matching subtype found

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2025-11-30 13:36:44 +01:00
parent 58e1238967
commit 6c194007a1
+1 -1
View File
@@ -23,7 +23,7 @@ def leases(leases_file):
else:
dt = datetime.fromtimestamp(int(tokens[0]),
tz=timezone.utc)
expires = dt.isoformat() + "+00:00"
expires = dt.isoformat()
row = {
"expires": expires,