Add DELETED event handler

This commit is contained in:
Joshua Boniface 2018-10-04 00:10:13 -04:00
parent 7d33e2d154
commit 2103d5f8b7
1 changed files with 5 additions and 0 deletions

View File

@ -143,6 +143,11 @@ class VXNetworkInstance():
@self.zk_conn.ChildrenWatch('/networks/{}/dhcp_reservations'.format(self.vni)) @self.zk_conn.ChildrenWatch('/networks/{}/dhcp_reservations'.format(self.vni))
def watch_network_dhcp_reservations(reservations, event=''): def watch_network_dhcp_reservations(reservations, event=''):
if event and event.type == 'DELETED':
# The key has been deleted after existing before; terminate this watcher
# because this class instance is about to be reaped in Daemon.py
return False
if self.dhcp_reservations != reservations: if self.dhcp_reservations != reservations:
for reservation in reservations: for reservation in reservations:
if reservation not in self.dhcp_reservations: if reservation not in self.dhcp_reservations: