diff options
author | Christian Breunig <christian@breunig.cc> | 2024-04-03 19:23:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-03 19:23:14 +0200 |
commit | d4b53a38359d80a4578d6fb2d8c76241b310f866 (patch) | |
tree | 72d8b52266a25c26132c615b64adfa8b3345ff7c /python/vyos/configverify.py | |
parent | fe09b767cfae7879dcbb8b2cfd52644342776b7e (diff) | |
parent | 74198e68a6edbdb36a6103a7666de530bdd71696 (diff) | |
download | vyos-1x-d4b53a38359d80a4578d6fb2d8c76241b310f866.tar.gz vyos-1x-d4b53a38359d80a4578d6fb2d8c76241b310f866.zip |
Merge pull request #3240 from c-po/spring-cleaning
T6199: spring cleaning - drop unused Python imports
Diffstat (limited to 'python/vyos/configverify.py')
-rw-r--r-- | python/vyos/configverify.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/python/vyos/configverify.py b/python/vyos/configverify.py index 300647d21..18642877a 100644 --- a/python/vyos/configverify.py +++ b/python/vyos/configverify.py @@ -23,8 +23,6 @@ from vyos import ConfigError from vyos.utils.dict import dict_search -from vyos.utils.dict import dict_search_recursive - # pattern re-used in ipsec migration script dynamic_interface_pattern = r'(ppp|pppoe|sstpc|l2tp|ipoe)[0-9]+' @@ -246,7 +244,6 @@ def verify_interface_exists(ifname, warning_only=False): if the interface is defined on the CLI, if it's not found we try if it exists at the OS level. """ - import os from vyos.base import Warning from vyos.configquery import ConfigTreeQuery from vyos.utils.dict import dict_search_recursive @@ -275,7 +272,7 @@ def verify_source_interface(config): required by e.g. peth/MACvlan, MACsec ... """ import re - from netifaces import interfaces + from vyos.utils.network import interface_exists ifname = config['ifname'] if 'source_interface' not in config: @@ -287,7 +284,7 @@ def verify_source_interface(config): if tmp.match(src_ifname): raise ConfigError(f'Can not source "{ifname}" from dynamic interface "{src_ifname}"!') - if src_ifname not in interfaces(): + if not interface_exists(src_ifname): raise ConfigError(f'Specified source-interface {src_ifname} does not exist') if 'source_interface_is_bridge_member' in config: |