diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-12-17 08:29:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-17 08:29:12 +0100 |
commit | 76cf45917de5ed3a04132029d33a240ebd5877d6 (patch) | |
tree | 07ffee72afccd941a60508ba56b6e65424d96bd0 /src/op_mode/openconnect.py | |
parent | 0c51111829dcd7660fc5405ae6ac651a8b6987b8 (diff) | |
parent | d7a67aa4a7e7bb82a60ad18103abc6b966a2f8b8 (diff) | |
download | vyos-1x-76cf45917de5ed3a04132029d33a240ebd5877d6.tar.gz vyos-1x-76cf45917de5ed3a04132029d33a240ebd5877d6.zip |
Merge branch 'current' into goodnetnick-shloginotp-T4754
Diffstat (limited to 'src/op_mode/openconnect.py')
-rwxr-xr-x | src/op_mode/openconnect.py | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/op_mode/openconnect.py b/src/op_mode/openconnect.py index 00992c66a..b21890728 100755 --- a/src/op_mode/openconnect.py +++ b/src/op_mode/openconnect.py @@ -31,14 +31,7 @@ occtl_socket = '/run/ocserv/occtl.socket' def _get_raw_data_sessions(): rc, out = rc_cmd(f'sudo {occtl} --json --socket-file {occtl_socket} show users') if rc != 0: - output = {'openconnect': - { - 'configured': False, - 'return_code': rc, - 'reason': out - } - } - return output + raise vyos.opmode.DataUnavailable(out) sessions = json.loads(out) return sessions @@ -61,9 +54,8 @@ def _get_formatted_sessions(data): def show_sessions(raw: bool): config = ConfigTreeQuery() - if not config.exists('vpn openconnect') and not raw: - print('Openconnect is not configured') - exit(0) + if not config.exists('vpn openconnect'): + raise vyos.opmode.UnconfiguredSubsystem('Openconnect is not configured') openconnect_data = _get_raw_data_sessions() if raw: |