]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
vici: Decode error messages in Python bindings
authorTobias Brunner <tobias@strongswan.org>
Wed, 13 Jan 2021 13:41:50 +0000 (14:41 +0100)
committerTobias Brunner <tobias@strongswan.org>
Mon, 18 Jan 2021 16:39:15 +0000 (17:39 +0100)
Otherwise we might end up with b'<errmsg>' in the output.

src/libcharon/plugins/vici/python/vici/session.py

index 0d6ee9b65109c52f2c69a6e6534d42b8adf14dca..0a2a02f91b1c194751baede614fb6aed74df2d8b 100644 (file)
@@ -78,7 +78,7 @@ class Session(CommandWrappers, object):
             if command_response["success"] != b"yes":
                 raise CommandException(
                     "Command failed: {errmsg}".format(
-                        errmsg=command_response["errmsg"]
+                        errmsg=command_response["errmsg"].decode("UTF-8")
                     )
                 )
 
@@ -135,7 +135,7 @@ class Session(CommandWrappers, object):
             if command_response["success"] != b"yes":
                 raise CommandException(
                     "Command failed: {errmsg}".format(
-                        errmsg=command_response["errmsg"]
+                        errmsg=command_response["errmsg"].decode("UTF-8")
                     )
                 )