Skip to content

Commit

Permalink
Merge pull request #2128 from aapostoliuk/T5426-sagitta
Browse files Browse the repository at this point in the history
ipsec: T5426: Added  exceptions in vici functions calls
  • Loading branch information
c-po authored Aug 2, 2023
2 parents ea30c03 + c7f872b commit f8cc7f8
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions python/vyos/ipsec.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
"""
Expand Down

0 comments on commit f8cc7f8

Please sign in to comment.