diff options
author | Christian Breunig <christian@breunig.cc> | 2024-06-26 16:35:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-26 16:35:11 +0200 |
commit | 5dfe56e45d5dd0ae3da954095a814b380d29114a (patch) | |
tree | 5a6656a74e720502d97daf91d5055a386a53f71e /python/vyos | |
parent | e458035e1ab56c7c21e53f26d8a39f00a62e5c9c (diff) | |
parent | e47d4fd385631236da6882233b09f6364cbb077b (diff) | |
download | vyos-1x-5dfe56e45d5dd0ae3da954095a814b380d29114a.tar.gz vyos-1x-5dfe56e45d5dd0ae3da954095a814b380d29114a.zip |
Merge pull request #3724 from c-po/T6519-migration
interfaces: T6519: harden config migration if ethernet interface is missing
Diffstat (limited to 'python/vyos')
-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: |