aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2015-03-09 12:16:10 +0100
committerMartin Willi <martin@revosec.ch>2015-03-18 13:59:14 +0100
commitb5d17e55d78c513ba0642c96f32685297d82b24c (patch)
tree484c7a3390f444a54aef31a0c6c4df25d3158cbd
parent90c5b48c96d7d34fbc446660449892f3bd3b9040 (diff)
downloadstrongswan-b5d17e55d78c513ba0642c96f32685297d82b24c.tar.bz2
strongswan-b5d17e55d78c513ba0642c96f32685297d82b24c.tar.xz
vici: Evaluate Python streamed command results, and raise CommandException
-rw-r--r--src/libcharon/plugins/vici/python/vici/session.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/libcharon/plugins/vici/python/vici/session.py b/src/libcharon/plugins/vici/python/vici/session.py
index da79ecd64..9f4dc5fa7 100644
--- a/src/libcharon/plugins/vici/python/vici/session.py
+++ b/src/libcharon/plugins/vici/python/vici/session.py
@@ -295,7 +295,7 @@ class SessionHandler(object):
break
if response.response_type == Packet.CMD_RESPONSE:
- Message.deserialize(response.payload)
+ command_response = Message.deserialize(response.payload)
else:
raise SessionException(
"Unexpected response type {type}, "
@@ -316,3 +316,12 @@ class SessionHandler(object):
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"]
+ )
+ )