From 4780fe548b86eba7f64a57ccf2d000958c238253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Knecht?= Date: Fri, 14 Jun 2019 10:12:18 +0200 Subject: [PATCH] bgp: Gracefully handle missing last_known_router_id When a server is deleted before its floating IP has been disassociated, the notification doens't contain a `last_known_router_id` key, which results in a `KeyError` exception being thrown. This commit gracefully handles this situation by setting `last_router_id` to `None` when `last_known_router_id` is missing. Change-Id: If127a33cec7ce6c4d264a191df37c30decab4daa Closes-Bug: #1795816 --- neutron_dynamic_routing/services/bgp/bgp_plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neutron_dynamic_routing/services/bgp/bgp_plugin.py b/neutron_dynamic_routing/services/bgp/bgp_plugin.py index bae0f480..3c8b7a22 100644 --- a/neutron_dynamic_routing/services/bgp/bgp_plugin.py +++ b/neutron_dynamic_routing/services/bgp/bgp_plugin.py @@ -230,7 +230,7 @@ class BgpPlugin(service_base.ServicePluginBase, ctx = context.get_admin_context() new_router_id = kwargs['router_id'] - last_router_id = kwargs['last_known_router_id'] + last_router_id = kwargs.get('last_known_router_id') floating_ip_address = kwargs['floating_ip_address'] dest = floating_ip_address + '/32' bgp_speakers = self._bgp_speakers_for_gw_network_by_family(