From adae5c7ccf9a7016fa445630ea2064acc1e0cd90 Mon Sep 17 00:00:00 2001 From: tim-rj Date: Fri, 6 Nov 2020 09:08:04 +0800 Subject: [PATCH] [master] fix del portchannel but vlan_member still contain portchannel Signed-off-by: tim-rj --- config/main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/main.py b/config/main.py index d708f95240..876e730b11 100755 --- a/config/main.py +++ b/config/main.py @@ -1314,6 +1314,10 @@ def remove_portchannel(ctx, portchannel_name): click.echo("Error: Portchannel {} contains members. Remove members before deleting Portchannel!".format(portchannel_name)) else: db.set_entry('PORTCHANNEL', portchannel_name, None) + # VLAN_MEMBER will contain portchannel also + keys = [ (k, v) for k, v in db.get_table('VLAN_MEMBER') if v == portchannel_name ] + for k in keys: + db.set_entry('VLAN_MEMBER', k, None) @portchannel.group(cls=clicommon.AbbreviationGroup, name='member') @click.pass_context