From 2ae623b2b4c8b7868f45619ba1a5da92f95968c0 Mon Sep 17 00:00:00 2001 From: Frode Nordahl Date: Mon, 9 Oct 2023 14:23:29 +0200 Subject: [PATCH] l3_extra_gws: Fix KeyError when removing extra GW port If the port being removed is not the first one, the current code will raise a KeyError. Signed-off-by: Frode Nordahl Change-Id: I948ff385e8a6aa7ecccce26b04a9d67affaede2c --- neutron/db/l3_extra_gws_db.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neutron/db/l3_extra_gws_db.py b/neutron/db/l3_extra_gws_db.py index be6da9ae532..2611ec36ddc 100644 --- a/neutron/db/l3_extra_gws_db.py +++ b/neutron/db/l3_extra_gws_db.py @@ -349,7 +349,7 @@ class ExtraGatewaysDbOnlyMixin(l3_gwmode_db.L3_NAT_dbonly_mixin): # If the compatibility gw_port_id is to be removed, do it after # the removal of extra gateway ports but stash up some information. - compat_gw_port_info = part_matches.pop(router_db['gw_port_id']) + compat_gw_port_info = part_matches.pop(router_db['gw_port_id'], None) # Actually remove extra gateways first. for extra_gw_port_id in part_matches.keys():