summaryrefslogtreecommitdiff
path: root/python/vyos
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-01-07 22:59:55 +0100
committerChristian Poessinger <christian@poessinger.com>2021-01-07 23:23:53 +0100
commitaa7b5972d48ad05824bfffdf1c5df5a6c2b1e37b (patch)
treedca2a89d965d80e4b31028a39df18616f84fe464 /python/vyos
parentfde684497e9be82123cffefa3e4766689e4dabc6 (diff)
downloadvyos-1x-aa7b5972d48ad05824bfffdf1c5df5a6c2b1e37b.tar.gz
vyos-1x-aa7b5972d48ad05824bfffdf1c5df5a6c2b1e37b.zip
vyos.configverify: provide generic helper to check for interface existence
Diffstat (limited to 'python/vyos')
-rw-r--r--python/vyos/configverify.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/python/vyos/configverify.py b/python/vyos/configverify.py
index b4447306e..bcaec55be 100644
--- a/python/vyos/configverify.py
+++ b/python/vyos/configverify.py
@@ -136,15 +136,14 @@ def verify_bridge_delete(config):
'Interface "{ifname}" cannot be deleted as it is a '
'member of bridge "{is_bridge_member}"!'.format(**config))
-def verify_interface_exists(config):
+def verify_interface_exists(ifname):
"""
Common helper function used by interface implementations to perform
recurring validation if an interface actually exists.
"""
from netifaces import interfaces
- if not config['ifname'] in interfaces():
- raise ConfigError('Interface "{ifname}" does not exist!'
- .format(**config))
+ if ifname not in interfaces():
+ raise ConfigError(f'Interface "{ifname}" does not exist!')
def verify_source_interface(config):
"""