From 3cb7d4f8157afd28c03cb58589d3ac5f68c9b8ba Mon Sep 17 00:00:00 2001 From: khramshinr Date: Thu, 18 Jul 2024 18:16:07 +0600 Subject: T6578: Fix unhandled exception in "show openconnect-server sessions" (cherry picked from commit e858d96a3fbc1ae4719a50ee67df02b2f256b40f) --- src/op_mode/openconnect.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/op_mode/openconnect.py b/src/op_mode/openconnect.py index cfa0678a7..62c683ebb 100755 --- a/src/op_mode/openconnect.py +++ b/src/op_mode/openconnect.py @@ -42,8 +42,10 @@ def _get_formatted_sessions(data): ses_list = [] for ses in data: ses_list.append([ - ses["Device"], ses["Username"], ses["IPv4"], ses["Remote IP"], - ses["_RX"], ses["_TX"], ses["State"], ses["_Connected at"] + ses.get("Device", '(none)'), ses.get("Username", '(none)'), + ses.get("IPv4", '(none)'), ses.get("Remote IP", '(none)'), + ses.get("_RX", '(none)'), ses.get("_TX", '(none)'), + ses.get("State", '(none)'), ses.get("_Connected at", '(none)') ]) if len(ses_list) > 0: output = tabulate(ses_list, headers) -- cgit v1.2.3