]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
cooker/command: Add error state for the server and use for pre_serve errors
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 6 Oct 2013 12:42:39 +0000 (13:42 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 14 Oct 2013 15:58:55 +0000 (16:58 +0100)
Currently if errors occur when starting the PR service, there is a race that
occurs since the UI runs various commands including starting builds before
processing the CookerExit(). By adding the error state and refusing to run
async commands in this mode, builds are prevented from starting and the
UI reaches the exit code with the system shutting down cleanly.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/bb/command.py
lib/bb/cooker.py

index 3ca27a69e0f42798e68f04be90e6e240e9fc57b5..a2795ce0b71eba62bfd4ad3c9c62290e4a7127dd 100644 (file)
@@ -86,6 +86,8 @@ class Command:
 
     def runAsyncCommand(self):
         try:
+            if self.cooker.state == bb.cooker.state.error:
+                return False
             if self.currentAsyncCommand is not None:
                 (command, options) = self.currentAsyncCommand
                 commandmethod = getattr(CommandsAsync, command)
index ad36b34aa481e02c74af53f4f6ab8349e816b603..b504f45da68a5ba0a5f950c20db248cbbd73cdbc 100644 (file)
@@ -61,7 +61,7 @@ class CollectionError(bb.BBHandledException):
     """
 
 class state:
-    initial, parsing, running, shutdown, forceshutdown, stopped = range(6)
+    initial, parsing, running, shutdown, forceshutdown, stopped, error = range(7)
 
 
 class SkippedPackage:
@@ -1321,6 +1321,7 @@ class BBCooker:
             self.prhost = prserv.serv.auto_start(self.data)
         except prserv.serv.PRServiceConfigError:
             bb.event.fire(CookerExit(), self.event_data)
+            self.state = state.error
         return
 
     def post_serve(self):