From 1cbc66dccfb6d1b1cd5bb1e12bfdd3750878c106 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Sun, 13 Jun 2021 21:10:42 -0400 Subject: [PATCH] Fix bugs in lease listing --- daemon-common/network.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/daemon-common/network.py b/daemon-common/network.py index f598ec81..af0f7048 100644 --- a/daemon-common/network.py +++ b/daemon-common/network.py @@ -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))