From 4612c8086f753b3857cabb8d9ae34457091df1b0 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Sun, 30 Sep 2018 19:25:21 -0400 Subject: [PATCH] Fix bug where network list grows --- router-daemon/pvcrd/Daemon.py | 2 +- router-daemon/pvcrd/RouterInstance.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/router-daemon/pvcrd/Daemon.py b/router-daemon/pvcrd/Daemon.py index bc89113a..41c1b0cc 100644 --- a/router-daemon/pvcrd/Daemon.py +++ b/router-daemon/pvcrd/Daemon.py @@ -249,10 +249,10 @@ def updatenetworks(new_network_list): s_network[network].stopDHCPServer() s_network[network].removeGatewayAddress() s_network[network].removeNetwork() + network_list = new_network_list for router in router_list: if router in t_router: t_router[router].updatenetworklist(s_network) - network_list = new_network_list print(ansiiprint.blue() + 'Network list: ' + ansiiprint.end() + '{}'.format(' '.join(network_list))) # Create timer to update this router in Zookeeper diff --git a/router-daemon/pvcrd/RouterInstance.py b/router-daemon/pvcrd/RouterInstance.py index d57f2813..413689a9 100644 --- a/router-daemon/pvcrd/RouterInstance.py +++ b/router-daemon/pvcrd/RouterInstance.py @@ -126,8 +126,10 @@ class RouterInstance(): def updatenetworklist(self, s_network): self.s_network = s_network + network_list = [] for network in s_network: - self.network_list.append(s_network[network].getvni()) + network_list.append(s_network[network].getvni()) + self.network_list = network_list def become_secondary(self): ansiiprint.echo('Setting router {} to secondary state'.format(self.name), '', 'i')