summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-06-26 17:28:35 +0200
committerGitHub <noreply@github.com>2024-06-26 17:28:35 +0200
commit255dc6b42853d868cefee022b1bba77303635eb1 (patch)
tree0490fc6fa1edcc7a9d21f05c2ed0f6733efe1b80 /src
parent2b5565bc5f3469dc34b47ee400173fb95fc5f6fd (diff)
parentec6bfeadbcfd838b43f49c6996430b8370caecc4 (diff)
downloadvyos-1x-255dc6b42853d868cefee022b1bba77303635eb1.tar.gz
vyos-1x-255dc6b42853d868cefee022b1bba77303635eb1.zip
Merge pull request #3726 from vyos/mergify/bp/circinus/pr-3724
interfaces: T6519: harden config migration if ethernet interface is missing (backport #3724)
Diffstat (limited to 'src')
-rwxr-xr-xsrc/migration-scripts/interfaces/20-to-217
1 files changed, 6 insertions, 1 deletions
diff --git a/src/migration-scripts/interfaces/20-to-21 b/src/migration-scripts/interfaces/20-to-21
index 14ad0fe4d..05a0c7237 100755
--- a/src/migration-scripts/interfaces/20-to-21
+++ b/src/migration-scripts/interfaces/20-to-21
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2021 VyOS maintainers and contributors
+# Copyright (C) 2021-2024 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -22,6 +22,7 @@ from sys import argv
from vyos.ethtool import Ethtool
from vyos.configtree import ConfigTree
+from vyos.utils.network import interface_exists
if len(argv) < 2:
print("Must specify file name!")
@@ -38,6 +39,10 @@ if not config.exists(base):
exit(0)
for ifname in config.list_nodes(base):
+ # Bail out early if interface vanished from system
+ if not interface_exists(ifname):
+ continue
+
eth = Ethtool(ifname)
# If GRO is enabled by the Kernel - we reflect this on the CLI. If GRO is