summaryrefslogtreecommitdiff
path: root/src/conf_mode/system_option.py
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-04-03 00:01:13 +0200
committerChristian Breunig <christian@breunig.cc>2024-04-03 21:01:50 +0200
commit86f793fcb2c6be880819a572cc7982861ca38314 (patch)
treebd87b2fc0c17921adba331b4ebe7b5f4ce1c6983 /src/conf_mode/system_option.py
parent9305f615e55c68efb2d9c5feb65bc716efa6c20d (diff)
downloadvyos-1x-86f793fcb2c6be880819a572cc7982861ca38314.tar.gz
vyos-1x-86f793fcb2c6be880819a572cc7982861ca38314.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 (cherry picked from commit 4c7c168fe970b807750a05ceb66b70c0d8652535)
Diffstat (limited to 'src/conf_mode/system_option.py')
-rwxr-xr-xsrc/conf_mode/system_option.py6
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')