From 29dd5079ad38e82363032b585304d509db0fea8e Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Thu, 30 Jul 2020 23:31:55 +0200 Subject: ifconfig: T2653: remove duplicated code for address flush --- python/vyos/ifconfig/bond.py | 8 ++++---- python/vyos/ifconfig/bridge.py | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/python/vyos/ifconfig/bond.py b/python/vyos/ifconfig/bond.py index 5a48ac632..5c9a43c9b 100644 --- a/python/vyos/ifconfig/bond.py +++ b/python/vyos/ifconfig/bond.py @@ -362,10 +362,10 @@ class BondIf(Interface): value = jmespath.search('member.interface', config) if value: for interface in value: - # if we've come here we already verified the interface does - # not have an addresses configured so just flush any - # remaining ones - cmd(f'ip addr flush dev "{interface}"') + # if we've come here we already verified the interface + # does not have an addresses configured so just flush + # any remaining ones + self.flush_addrs(interface) self.add_port(interface) # Primary device interface - must be set after 'mode' diff --git a/python/vyos/ifconfig/bridge.py b/python/vyos/ifconfig/bridge.py index da4e1a289..e4ae0a80a 100644 --- a/python/vyos/ifconfig/bridge.py +++ b/python/vyos/ifconfig/bridge.py @@ -237,9 +237,10 @@ class BridgeIf(Interface): tmp = jmespath.search('member.interface', config) if tmp: for interface, interface_config in tmp.items(): - # if we've come here we already verified the interface doesn't - # have addresses configured so just flush any remaining ones - cmd(f'ip addr flush dev "{interface}"') + # if we've come here we already verified the interface + # does not have an addresses configured so just flush + # any remaining ones + self.flush_addrs(interface) # enslave interface port to bridge self.add_port(interface) -- cgit v1.2.3