From: Ondrej Lichtner <olichtne(a)redhat.com>
The communication protocol that was implemented can also send error
messages, however the Controller wasn't handling them and instead raised
an Unknown message exception. This patch fixes that by raising an
exception with the correct message.
I also modified the message that Slave sends when an unsupported method
call is recieved.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Controller/NetTestController.py | 4 ++++
lnst/Slave/NetTestSlave.py | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py
index 62600ca..169f0af 100644
--- a/lnst/Controller/NetTestController.py
+++ b/lnst/Controller/NetTestController.py
@@ -394,6 +394,10 @@ class MessageDispatcher(ConnectionHandler):
elif message[1]["type"] == "exception":
msg = "Recieved an exception from slave: %s" % message[0]
raise CommandException(msg)
+ elif message[1]["type"] == "error":
+ msg = "Recieved an error message from slave %s: %s" %\
+ (message[0], message[1]["err"])
+ raise CommandException(msg)
else:
msg = "Unknown message type: %s" % message[1]["type"]
raise NetTestError(msg)
diff --git a/lnst/Slave/NetTestSlave.py b/lnst/Slave/NetTestSlave.py
index 2b0def5..9b39c0a 100644
--- a/lnst/Slave/NetTestSlave.py
+++ b/lnst/Slave/NetTestSlave.py
@@ -437,7 +437,7 @@ class NetTestSlave:
self._cmd_context.cleanup()
self._log_ctl.cancel_connection()
else:
- err = "Method not found: %s" % msg["method_name"]
+ err = "Method '%s' not supported." % msg["method_name"]
response = {"type": "error", "err": err}
if not self._server_handler.send_data_to_ctl(response):
self._cmd_context.cleanup()
--
1.7.11.7