diff options
author | Christian Breunig <christian@breunig.cc> | 2024-06-26 17:28:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-26 17:28:35 +0200 |
commit | 255dc6b42853d868cefee022b1bba77303635eb1 (patch) | |
tree | 0490fc6fa1edcc7a9d21f05c2ed0f6733efe1b80 /python | |
parent | 2b5565bc5f3469dc34b47ee400173fb95fc5f6fd (diff) | |
parent | ec6bfeadbcfd838b43f49c6996430b8370caecc4 (diff) | |
download | vyos-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 'python')
-rw-r--r-- | python/vyos/ethtool.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/python/vyos/ethtool.py b/python/vyos/ethtool.py index d45c9c272..80bb56fa2 100644 --- a/python/vyos/ethtool.py +++ b/python/vyos/ethtool.py @@ -16,6 +16,7 @@ import re from json import loads +from vyos.utils.network import interface_exists from vyos.utils.process import popen # These drivers do not support using ethtool to change the speed, duplex, or @@ -64,6 +65,9 @@ class Ethtool: def __init__(self, ifname): # Get driver used for interface + if not interface_exists(ifname): + raise ValueError(f'Interface "{ifname}" does not exist!') + out, _ = popen(f'ethtool --driver {ifname}') driver = re.search(r'driver:\s(\w+)', out) if driver: |