diff options
author | Christian Breunig <christian@breunig.cc> | 2024-04-03 00:01:13 +0200 |
---|---|---|
committer | Christian Breunig <christian@breunig.cc> | 2024-04-03 00:01:13 +0200 |
commit | 4c7c168fe970b807750a05ceb66b70c0d8652535 (patch) | |
tree | 945345f3f465d9647d10f7fde742756d2c77e435 /src/conf_mode/system_option.py | |
parent | 86b632874288aa5707a94a4f28ca816e543823b9 (diff) | |
download | vyos-1x-4c7c168fe970b807750a05ceb66b70c0d8652535.tar.gz vyos-1x-4c7c168fe970b807750a05ceb66b70c0d8652535.zip |
T6199: replace netifaces.interfaces() with common custom helpers
* Use interface_exists() outside of verify()
* Use verify_interface_exists() in verify() to drop common error message
Diffstat (limited to 'src/conf_mode/system_option.py')
-rwxr-xr-x | src/conf_mode/system_option.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/conf_mode/system_option.py b/src/conf_mode/system_option.py index 7ed451e16..a2e5db575 100755 --- a/src/conf_mode/system_option.py +++ b/src/conf_mode/system_option.py @@ -16,12 +16,12 @@ import os -from netifaces import interfaces from sys import exit from time import sleep from vyos.config import Config from vyos.configverify import verify_source_interface +from vyos.configverify import verify_interface_exists from vyos.system import grub_util from vyos.template import render from vyos.utils.process import cmd @@ -56,9 +56,7 @@ def verify(options): if 'http_client' in options: config = options['http_client'] if 'source_interface' in config: - if not config['source_interface'] in interfaces(): - raise ConfigError(f'Source interface {source_interface} does not ' - f'exist'.format(**config)) + verify_interface_exists(config['source_interface']) if {'source_address', 'source_interface'} <= set(config): raise ConfigError('Can not define both HTTP source-interface and source-address') |