summaryrefslogtreecommitdiff
path: root/python/vyos
diff options
context:
space:
mode:
Diffstat (limited to 'python/vyos')
-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:
"""