aboutsummaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-06-04 15:47:02 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-06-06 10:32:54 +0100
commite89db137f008d7ead4e8ba81e704388eae69d7e4 (patch)
tree12e5df1984b98bfab52b32dc638026663bc0a3e0 /bitbake/lib
parenta5d01e9ec7176ad16e106b100861b488bc22081f (diff)
downloadopenembedded-core-contrib-e89db137f008d7ead4e8ba81e704388eae69d7e4.tar.gz
bitbake: xmlrpc: client - remove fatal errors
When we use the XMLRPC client API to connect to a bitbake server, we want to receive errors from the API instead of having the API exiting without warning. Thus the "bb.fatal" calls have been replaced with "bb.warn" calls, and we re-raise the original exception for handling by the original caller. The bitbake starting script has been modified to properly test for failures in calling the client API and handle them. Additional error handling added in the client, as to prevent fatal crashes. (Bitbake rev: eb63f08c33644f64752aaae2146a000956ce894a) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/server/xmlrpc.py21
-rw-r--r--bitbake/lib/bb/ui/uievent.py3
2 files changed, 16 insertions, 8 deletions
diff --git a/bitbake/lib/bb/server/xmlrpc.py b/bitbake/lib/bb/server/xmlrpc.py
index 6fc5543a80..d6f4338ae5 100644
--- a/bitbake/lib/bb/server/xmlrpc.py
+++ b/bitbake/lib/bb/server/xmlrpc.py
@@ -80,7 +80,7 @@ class BBTransport(xmlrpclib.Transport):
def _create_server(host, port, timeout = 60):
t = BBTransport(timeout)
- s = xmlrpclib.Server("http://%s:%d/" % (host, port), transport=t, allow_none=True)
+ s = xmlrpclib.ServerProxy("http://%s:%d/" % (host, port), transport=t, allow_none=True)
return s, t
class BitBakeServerCommands():
@@ -253,9 +253,13 @@ class XMLRPCServer(SimpleXMLRPCServer, BaseImplServer):
socktimeout = self.socket.gettimeout() or nextsleep
socktimeout = min(socktimeout, nextsleep)
# Mirror what BaseServer handle_request would do
- fd_sets = select.select(fds, [], [], socktimeout)
- if fd_sets[0] and self in fd_sets[0]:
- self._handle_request_noblock()
+ try:
+ fd_sets = select.select(fds, [], [], socktimeout)
+ if fd_sets[0] and self in fd_sets[0]:
+ self._handle_request_noblock()
+ except IOError:
+ # we ignore interrupted calls
+ pass
# Tell idle functions we're exiting
for function, data in self._idlefuns.items():
@@ -346,7 +350,8 @@ class BitBakeXMLRPCClient(BitBakeBaseServer):
[host, port] = self.remote.split(":")
port = int(port)
except Exception as e:
- bb.fatal("Failed to read remote definition (%s)" % str(e))
+ bb.warn("Failed to read remote definition (%s)" % str(e))
+ raise e
# We need our IP for the server connection. We get the IP
# by trying to connect with the server
@@ -356,13 +361,15 @@ class BitBakeXMLRPCClient(BitBakeBaseServer):
ip = s.getsockname()[0]
s.close()
except Exception as e:
- bb.fatal("Could not create socket for %s:%s (%s)" % (host, port, str(e)))
+ bb.warn("Could not create socket for %s:%s (%s)" % (host, port, str(e)))
+ raise e
try:
self.serverImpl = XMLRPCProxyServer(host, port)
self.connection = BitBakeXMLRPCServerConnection(self.serverImpl, (ip, 0), self.observer_only, featureset)
return self.connection.connect()
except Exception as e:
- bb.fatal("Could not connect to server at %s:%s (%s)" % (host, port, str(e)))
+ bb.warn("Could not connect to server at %s:%s (%s)" % (host, port, str(e)))
+ raise e
def endSession(self):
self.connection.removeClient()
diff --git a/bitbake/lib/bb/ui/uievent.py b/bitbake/lib/bb/ui/uievent.py
index 98658f68bf..eb760c00c3 100644
--- a/bitbake/lib/bb/ui/uievent.py
+++ b/bitbake/lib/bb/ui/uievent.py
@@ -47,7 +47,8 @@ class BBUIEventQueue:
self.EventHandle = self.BBServer.registerEventHandler(self.host, self.port)
if (self.EventHandle == None):
- bb.fatal("Could not register UI event handler")
+ bb.warn("Could not register UI event handler %s:%d" % (self.host, self.port))
+ raise Exception("Could not register UI event handler")
self.server = server