summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-08-02 12:30:00 +0200
committerGitHub <noreply@github.com>2023-08-02 12:30:00 +0200
commitf8cc7f8ee7c87bd95198dfe6c28c966e840ab571 (patch)
treeb04f27705b5dc6813ac188d4b0083f14082fe8fe
parentea30c0307996ec301474820bbcbf90d5eda7fda4 (diff)
parentc7f872b038df835ba909d294156792e4119ffc5e (diff)
downloadvyos-1x-f8cc7f8ee7c87bd95198dfe6c28c966e840ab571.tar.gz
vyos-1x-f8cc7f8ee7c87bd95198dfe6c28c966e840ab571.zip
Merge pull request #2128 from aapostoliuk/T5426-sagitta
ipsec: T5426: Added exceptions in vici functions calls
-rw-r--r--python/vyos/ipsec.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/python/vyos/ipsec.py b/python/vyos/ipsec.py
index bb5611025..4603aab22 100644
--- a/python/vyos/ipsec.py
+++ b/python/vyos/ipsec.py
@@ -33,9 +33,11 @@ def get_vici_sas():
session = vici_session()
except Exception:
raise ViciInitiateError("IPsec not initialized")
- sas = list(session.list_sas())
- return sas
-
+ try:
+ sas = list(session.list_sas())
+ return sas
+ except Exception:
+ raise ViciCommandError(f'Failed to get SAs')
def get_vici_connections():
from vici import Session as vici_session
@@ -44,9 +46,11 @@ def get_vici_connections():
session = vici_session()
except Exception:
raise ViciInitiateError("IPsec not initialized")
- connections = list(session.list_conns())
- return connections
-
+ try:
+ connections = list(session.list_conns())
+ return connections
+ except Exception:
+ raise ViciCommandError(f'Failed to get connections')
def get_vici_sas_by_name(ike_name: str, tunnel: str) -> list:
"""