mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-07 00:01:49 -04:00
vici: Evaluate Python streamed command results, and raise CommandException
This commit is contained in:
parent
90c5b48c96
commit
b5d17e55d7
@ -295,7 +295,7 @@ class SessionHandler(object):
|
|||||||
break
|
break
|
||||||
|
|
||||||
if response.response_type == Packet.CMD_RESPONSE:
|
if response.response_type == Packet.CMD_RESPONSE:
|
||||||
Message.deserialize(response.payload)
|
command_response = Message.deserialize(response.payload)
|
||||||
else:
|
else:
|
||||||
raise SessionException(
|
raise SessionException(
|
||||||
"Unexpected response type {type}, "
|
"Unexpected response type {type}, "
|
||||||
@ -316,3 +316,12 @@ class SessionHandler(object):
|
|||||||
confirm=Packet.EVENT_CONFIRM,
|
confirm=Packet.EVENT_CONFIRM,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# evaluate command result, if any
|
||||||
|
if "success" in command_response:
|
||||||
|
if command_response["success"] != "yes":
|
||||||
|
raise CommandException(
|
||||||
|
"Command failed: {errmsg}".format(
|
||||||
|
errmsg=command_response["errmsg"]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user