From 153a1c1d2549632342030fb4f7d41456b4f17fdb Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 29 May 2021 15:37:46 +0200 Subject: vti: T1579: only remove the interface when it exists --- src/conf_mode/interfaces-vti.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/conf_mode/interfaces-vti.py') diff --git a/src/conf_mode/interfaces-vti.py b/src/conf_mode/interfaces-vti.py index acd4a9790..09fd8f5f9 100755 --- a/src/conf_mode/interfaces-vti.py +++ b/src/conf_mode/interfaces-vti.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from netifaces import interfaces from sys import exit from vyos.config import Config @@ -64,9 +65,12 @@ def generate(vti): return None def apply(vti): - tmp = VTIIf(**vti) - tmp.remove() + if vti['ifname'] in interfaces(): + # Always delete the VTI interface in advance + VTIIf(**vti).remove() + if 'deleted' not in vti: + tmp = VTIIf(**vti) tmp.update(vti) return None -- cgit v1.2.3