summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/server/xmlrpc.py
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/bb/server/xmlrpc.py
parenta5d01e9ec7176ad16e106b100861b488bc22081f (diff)
downloadpoky-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/bb/server/xmlrpc.py')
-rw-r--r--bitbake/lib/bb/server/xmlrpc.py21
1 files changed, 14 insertions, 7 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):
80 80
81def _create_server(host, port, timeout = 60): 81def _create_server(host, port, timeout = 60):
82 t = BBTransport(timeout) 82 t = BBTransport(timeout)
83 s = xmlrpclib.Server("http://%s:%d/" % (host, port), transport=t, allow_none=True) 83 s = xmlrpclib.ServerProxy("http://%s:%d/" % (host, port), transport=t, allow_none=True)
84 return s, t 84 return s, t
85 85
86class BitBakeServerCommands(): 86class BitBakeServerCommands():
@@ -253,9 +253,13 @@ class XMLRPCServer(SimpleXMLRPCServer, BaseImplServer):
253 socktimeout = self.socket.gettimeout() or nextsleep 253 socktimeout = self.socket.gettimeout() or nextsleep
254 socktimeout = min(socktimeout, nextsleep) 254 socktimeout = min(socktimeout, nextsleep)
255 # Mirror what BaseServer handle_request would do 255 # Mirror what BaseServer handle_request would do
256 fd_sets = select.select(fds, [], [], socktimeout) 256 try:
257 if fd_sets[0] and self in fd_sets[0]: 257 fd_sets = select.select(fds, [], [], socktimeout)
258 self._handle_request_noblock() 258 if fd_sets[0] and self in fd_sets[0]:
259 self._handle_request_noblock()
260 except IOError:
261 # we ignore interrupted calls
262 pass
259 263
260 # Tell idle functions we're exiting 264 # Tell idle functions we're exiting
261 for function, data in self._idlefuns.items(): 265 for function, data in self._idlefuns.items():
@@ -346,7 +350,8 @@ class BitBakeXMLRPCClient(BitBakeBaseServer):
346 [host, port] = self.remote.split(":") 350 [host, port] = self.remote.split(":")
347 port = int(port) 351 port = int(port)
348 except Exception as e: 352 except Exception as e:
349 bb.fatal("Failed to read remote definition (%s)" % str(e)) 353 bb.warn("Failed to read remote definition (%s)" % str(e))
354 raise e
350 355
351 # We need our IP for the server connection. We get the IP 356 # We need our IP for the server connection. We get the IP
352 # by trying to connect with the server 357 # by trying to connect with the server
@@ -356,13 +361,15 @@ class BitBakeXMLRPCClient(BitBakeBaseServer):
356 ip = s.getsockname()[0] 361 ip = s.getsockname()[0]
357 s.close() 362 s.close()
358 except Exception as e: 363 except Exception as e:
359 bb.fatal("Could not create socket for %s:%s (%s)" % (host, port, str(e))) 364 bb.warn("Could not create socket for %s:%s (%s)" % (host, port, str(e)))
365 raise e
360 try: 366 try:
361 self.serverImpl = XMLRPCProxyServer(host, port) 367 self.serverImpl = XMLRPCProxyServer(host, port)
362 self.connection = BitBakeXMLRPCServerConnection(self.serverImpl, (ip, 0), self.observer_only, featureset) 368 self.connection = BitBakeXMLRPCServerConnection(self.serverImpl, (ip, 0), self.observer_only, featureset)
363 return self.connection.connect() 369 return self.connection.connect()
364 except Exception as e: 370 except Exception as e:
365 bb.fatal("Could not connect to server at %s:%s (%s)" % (host, port, str(e))) 371 bb.warn("Could not connect to server at %s:%s (%s)" % (host, port, str(e)))
372 raise e
366 373
367 def endSession(self): 374 def endSession(self):
368 self.connection.removeClient() 375 self.connection.removeClient()