Trap bad return values from Xen-API method handlers, and return an internal

error.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
This commit is contained in:
Ewan Mellor committed 2007-03-14 23:12:59 +00:00
1 parent efcaa9d8d3
commit 3c924c8c4c
1 file changed
+12
+12
View File
@@ -200,6 +200,18 @@ class TCPXMLRPCServer(SocketServer.ThreadingMixIn, SimpleXMLRPCServer):
else:
response = self._dispatch(method, params)
if self.xenapi and \
(response is None or
not isinstance(response, dict) or
'Status' not in response):
log.exception('Internal error handling %s: Invalid result %s',
method, response)
response = { "Status": "Failure",
"ErrorDescription":
['INTERNAL_ERROR',
'Invalid result %s handling %s' %
(response, method)]}
# With either Unicode or normal strings, we can only transmit
# \t, \n, \r, \u0020-\ud7ff, \ue000-\ufffd, and \u10000-\u10ffff
# in an XML document. xmlrpclib does not escape these values
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.