From 2f9d5cf583b4b5dd635f386cb9ac07435bd44cc8 Mon Sep 17 00:00:00 2001 From: Ilia Abashin Date: Fri, 25 Aug 2017 14:24:59 +0300 Subject: 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 --- app/discover/events/event_interface_add.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'app/discover/events/event_interface_add.py') diff --git a/app/discover/events/event_interface_add.py b/app/discover/events/event_interface_add.py index a06ad14..2c7af13 100644 --- a/app/discover/events/event_interface_add.py +++ b/app/discover/events/event_interface_add.py @@ -37,7 +37,9 @@ class EventInterfaceAdd(EventBase): router_doc['gw_port_id'] = router['gw_port_id'] # add gateway port documents. - port_doc = EventSubnetAdd().add_port_document(env, router_doc['gw_port_id'], project_name=project) + port_doc = EventSubnetAdd().add_port_document(env, + router_doc['gw_port_id'], + project_name=project) mac_address = port_doc['mac_address'] if port_doc else None @@ -87,7 +89,8 @@ class EventInterfaceAdd(EventBase): subnet_id = interface['subnet_id'] router_id = encode_router_id(host_id, interface['id']) - network_document = self.inv.get_by_field(env, "network", "subnet_ids", subnet_id, get_single=True) + network_document = self.inv.get_by_field(env, "network", "subnet_ids", + subnet_id, get_single=True) if not network_document: self.log.info("network document not found, aborting interface adding") return EventResult(result=False, retry=True) @@ -99,7 +102,8 @@ class EventInterfaceAdd(EventBase): fetcher = ApiFetchRegions() fetcher.set_env(env) fetcher.get(None) - port_doc = EventSubnetAdd().add_port_document(env, port_id, network_name=network_name) + port_doc = EventSubnetAdd().add_port_document(env, port_id, + network_name=network_name) mac_address = port_doc['mac_address'] if port_doc else None -- cgit 1.2.3-korg