aboutsummaryrefslogtreecommitdiffstats
path: root/app/discover/events/event_subnet_update.py
diff options
context:
space:
mode:
authorIlia Abashin <abashinos@gmail.com>2017-08-25 14:24:59 +0300
committerIlia Abashin <abashinos@gmail.com>2017-08-25 14:29:28 +0300
commit2f9d5cf583b4b5dd635f386cb9ac07435bd44cc8 (patch)
tree2c025d24aff9bb0192e6d221a4e989e327c72e7c /app/discover/events/event_subnet_update.py
parentde9f324ff628a6d9e870f06e6e216f65382a978b (diff)
Heavily refactored all event based scans
Restricted real mongo interaction. Still work to do, but it's a good start. Fixed a bug with old subnets not being properly deleted. Change-Id: I5f260e09f0e11a477a47cb031d397a454465123f Signed-off-by: Ilia Abashin <abashinos@gmail.com>
Diffstat (limited to 'app/discover/events/event_subnet_update.py')
-rw-r--r--app/discover/events/event_subnet_update.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/discover/events/event_subnet_update.py b/app/discover/events/event_subnet_update.py
index 9d3c48b..26d1984 100644
--- a/app/discover/events/event_subnet_update.py
+++ b/app/discover/events/event_subnet_update.py
@@ -93,10 +93,14 @@ class EventSubnetUpdate(EventBase):
if subnet['name'] == subnets[key]['name']:
subnets[key] = subnet
else:
- # TODO: #AskCheng shouldn't we remove the old one?
+ del subnets[key]
subnets[subnet['name']] = subnet
self.inv.set(network_document)
return EventResult(result=True,
related_object=subnet['id'],
display_context=network_id)
+ else:
+ self.log.info(
+ 'subnet not in network, aborting subnet update')
+ return EventResult(result=False, retry=False) \ No newline at end of file