diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-05-29 15:37:46 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-05-29 15:37:46 +0200 |
commit | 153a1c1d2549632342030fb4f7d41456b4f17fdb (patch) | |
tree | 8c0b5bc9ddd060f997b37e7b6b61e1270a982821 /src/conf_mode | |
parent | 0593173f6b7002b7d24f44b43eccbd07c71a3d79 (diff) | |
download | vyos-1x-153a1c1d2549632342030fb4f7d41456b4f17fdb.tar.gz vyos-1x-153a1c1d2549632342030fb4f7d41456b4f17fdb.zip |
vti: T1579: only remove the interface when it exists
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-x | src/conf_mode/interfaces-vti.py | 8 |
1 files changed, 6 insertions, 2 deletions
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 <http://www.gnu.org/licenses/>. +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 |