path: root/lib/prserv/serv.py
diff options
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-02 15:46:11 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-07 16:11:56 +0100
commit9c52c73fd2498e65be5f0da24dc2ae3803eb42eb (patch)
tree1d44dad458e76193522d398db25ade6f70e5e1d6 /lib/prserv/serv.py
parent56eac6ed2c14158e4f854f304fc875cee867f1b6 (diff)
prserv/cooker: Handle PRService errors cleanly1.16
Current if the PR Service fails to start, bitbake carries on regardless or hangs with no error message. This adds an exception and then handles it correctly so the UIs correctly handle the error and exit cleanly. [YOCTO #4010] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/prserv/serv.py')
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/prserv/serv.py b/lib/prserv/serv.py
index 5567c6f5..316512d7 100644
--- a/lib/prserv/serv.py
+++ b/lib/prserv/serv.py
@@ -266,17 +266,20 @@ def is_local_special(host, port):
return False
+class PRServiceConfigError(Exception):
+ pass
def auto_start(d):
global singleton
if (not d.getVar('PRSERV_HOST', True)) or (not d.getVar('PRSERV_PORT', True)):
- return True
+ return
if is_local_special(d.getVar('PRSERV_HOST', True), int(d.getVar('PRSERV_PORT', True))) and not singleton:
import bb.utils
cachedir = (d.getVar("PERSISTENT_DIR", True) or d.getVar("CACHE", True))
if not cachedir:
logger.critical("Please set the 'PERSISTENT_DIR' or 'CACHE' variable")
- sys.exit(1)
+ raise PRServiceConfigError
dbfile = os.path.join(cachedir, "prserv.sqlite3")
logfile = os.path.join(cachedir, "prserv.log")
@@ -292,7 +295,7 @@ def auto_start(d):
return PRServerConnection(host,port).ping()
except Exception:
logger.critical("PRservice %s:%d not available" % (host, port))
- return False
+ raise PRServiceConfigError
def auto_shutdown(d=None):
global singleton