When a remote RPC method raises an exception it's traceback is
marshalled back to the controller without the error message that
the exception carried. The traceback is suitable for debuging,
but it is certainly not suited for users.
This patch makes the dispatcher log the traceback to debug first
and then send only the error message. The traceback is transfered
to controller through the logging facility.
Signed-off-by: Radek Pazdera <rpazdera(a)redhat.com>
---
Common/XmlRpc.py | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/Common/XmlRpc.py b/Common/XmlRpc.py
index 3570495..9f16d06 100644
--- a/Common/XmlRpc.py
+++ b/Common/XmlRpc.py
@@ -20,6 +20,7 @@ jpirko(a)redhat.com (Jiri Pirko)
"""
from SimpleXMLRPCServer import SimpleXMLRPCServer
+from Common.Logs import log_exc_traceback
import xmlrpclib
import sys
import socket
@@ -58,9 +59,9 @@ class Server(SimpleXMLRPCServer):
def _dispatch(self, method, params):
try:
return SimpleXMLRPCServer._dispatch(self, method, params)
- except:
- type, value, tb = sys.exc_info()
- raise xmlrpclib.Fault(1, ''.join(traceback.format_exception(type,
value, tb)))
+ except Exception as err:
+ log_exc_traceback()
+ raise xmlrpclib.Fault(1, str(err))
def serve_until_done(self):
while self.util_inst.running:
--
1.7.7.6