From 3b8e691566bd12e931f57ac8e6a0a22dadc39da3 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 15 Mar 2020 18:41:07 +0100 Subject: ethernet: T2119: check if physical interface exists --- src/conf_mode/interfaces-ethernet.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/conf_mode/interfaces-ethernet.py') diff --git a/src/conf_mode/interfaces-ethernet.py b/src/conf_mode/interfaces-ethernet.py index 6d779c94c..ba3a5e8c8 100755 --- a/src/conf_mode/interfaces-ethernet.py +++ b/src/conf_mode/interfaces-ethernet.py @@ -238,6 +238,9 @@ def verify(eth): if eth['deleted']: return None + if eth['intf'] not in interfaces(): + raise ConfigError(f"Interface ethernet {eth['intf']} does not exist") + if eth['speed'] == 'auto': if eth['duplex'] != 'auto': raise ConfigError('If speed is hardcoded, duplex must be hardcoded, too') @@ -260,7 +263,7 @@ def verify(eth): bond_member = conf.return_values('interfaces bonding ' + bond + ' member interface') if eth['intf'] in bond_member: if eth['address']: - raise ConfigError('Can not assign address to interface {} which is a member of {}'.format(eth['intf'], bond)) + raise ConfigError(f"Can not assign address to interface {eth['intf']} which is a member of {bond}") # use common function to verify VLAN configuration verify_vlan_config(eth) -- cgit v1.2.3