Fix bugs in lease listing

This commit is contained in:
Joshua Boniface 2021-06-13 21:10:42 -04:00
parent bbd903e568
commit 1cbc66dccf
1 changed files with 3 additions and 3 deletions

View File

@ -171,12 +171,12 @@ def getDHCPLeaseInformation(zkhandler, vni, mac_address):
# Check whether this is a dynamic or static lease
if zkhandler.exists(('network.lease', vni, 'lease', mac_address)):
type_key = 'lease'
if zkhandler.exists(('network.reservation', vni, 'reservation', mac_address)):
elif zkhandler.exists(('network.reservation', vni, 'reservation', mac_address)):
type_key = 'reservation'
else:
return {}
return None
hostname = zkhandler.read((f'network.{type_key}', vni, f'{type_key}', mac_address))
hostname = zkhandler.read((f'network.{type_key}', vni, f'{type_key}.hostname', mac_address))
ip4_address = zkhandler.read((f'network.{type_key}', vni, f'{type_key}.ip', mac_address))
if type_key == 'dhcp4_leases':
timestamp = zkhandler.read((f'network.{type_key}', vni, f'{type_key}.expiry', mac_address))