diff options
| author | Yuriy Andamasov <yuriy@vyos.io> | 2026-05-13 05:56:50 -0700 |
|---|---|---|
| committer | Yuriy Andamasov <yuriy@vyos.io> | 2026-05-13 05:56:50 -0700 |
| commit | d004a2b5caa9b819d93af897b1c218a2f3197c8b (patch) | |
| tree | 946ca55b473841615fa77e61847f9995acb0b350 /src/conf_mode/interfaces_ethernet.py | |
| parent | f1a412985288730cc65a250da2bd4f5b87ade43f (diff) | |
| download | vyos-1x-d004a2b5caa9b819d93af897b1c218a2f3197c8b.tar.gz vyos-1x-d004a2b5caa9b819d93af897b1c218a2f3197c8b.zip | |
python: T8857: replace bare except clauses with except Exception in config scripts
Bare except: catches everything derived from BaseException, including
SystemExit and KeyboardInterrupt. Config scripts must not silently
continue past sys.exit(), so replace bare except: with except Exception:
in the three config-mode scripts that contained one.
Library code (python/vyos/configverify.py, python/vyos/config.py) and
op-mode scripts are intentionally out of scope: those cases require
case-by-case design review (e.g. MTU lookups should accept defaults as
arguments rather than rely on exception handling; reset-style op-mode
scripts may legitimately want to ignore KeyboardInterrupt).
Sites changed:
- src/conf_mode/interfaces_ethernet.py (MTU adapter lookup)
- src/conf_mode/vpp_interfaces_bonding.py (MAC validation)
- src/conf_mode/container.py x2 (IPv4 / IPv6 prefix lookup)
Diffstat (limited to 'src/conf_mode/interfaces_ethernet.py')
| -rwxr-xr-x | src/conf_mode/interfaces_ethernet.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/conf_mode/interfaces_ethernet.py b/src/conf_mode/interfaces_ethernet.py index 2eb36a231..b9177cd34 100755 --- a/src/conf_mode/interfaces_ethernet.py +++ b/src/conf_mode/interfaces_ethernet.py @@ -159,7 +159,7 @@ def get_config(config=None): max_mtu = EthernetIf(ifname).get_max_mtu() if max_mtu < int(ethernet['mtu']): ethernet['mtu'] = str(max_mtu) - except: + except Exception: pass if 'is_bond_member' in ethernet: |
