diff options
author | Christian Breunig <christian@breunig.cc> | 2023-05-04 22:51:36 +0200 |
---|---|---|
committer | Christian Breunig <christian@breunig.cc> | 2023-05-04 22:51:36 +0200 |
commit | 2589efdda542c0dea963a12516e25df449e4662e (patch) | |
tree | 781925e025a07fbc764c30de4475ac86b6c6f908 /src/op_mode/show_wwan.py | |
parent | f2ecc9710d49d320409700bc72f42632f72b369d (diff) | |
download | vyos-1x-2589efdda542c0dea963a12516e25df449e4662e.tar.gz vyos-1x-2589efdda542c0dea963a12516e25df449e4662e.zip |
wwan: op-mode: T5196: inform user about unconfigured interface
Diffstat (limited to 'src/op_mode/show_wwan.py')
-rwxr-xr-x | src/op_mode/show_wwan.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/op_mode/show_wwan.py b/src/op_mode/show_wwan.py index 529b5bd0f..eb601a456 100755 --- a/src/op_mode/show_wwan.py +++ b/src/op_mode/show_wwan.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2021 VyOS maintainers and contributors +# Copyright (C) 2021-2023 VyOS maintainers and contributors # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 or later as @@ -17,6 +17,7 @@ import argparse from sys import exit +from vyos.configquery import ConfigTreeQuery from vyos.util import cmd parser = argparse.ArgumentParser() @@ -49,6 +50,11 @@ def qmi_cmd(device, command, silent=False): if __name__ == '__main__': args = parser.parse_args() + tmp = ConfigTreeQuery() + if not tmp.exists(['interfaces', 'wwan', args.interface]): + print(f'Interface "{args.interface}" unconfigured!') + exit(1) + # remove the WWAN prefix from the interface, required for the CDC interface if_num = args.interface.replace('wwan','') cdc = f'/dev/cdc-wdm{if_num}' |