[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.42-59-gc28b2f1
Andreas Beckmann
debian at abeckmann.de
Sat Mar 10 09:08:50 UTC 2012
The following commit has been merged in the develop branch:
commit c72ae3dfcf066e34625d06bfa3ca4c47a3423017
Author: Andreas Beckmann <debian at abeckmann.de>
Date: Mon Mar 5 17:57:36 2012 +0100
handle master returning 'busy'
If there is another slave currently talking to the master
(accessing the current section), try again later.
Signed-off-by: Andreas Beckmann <debian at abeckmann.de>
diff --git a/piuparts-slave.py b/piuparts-slave.py
index 9fe7777..8b3c51e 100644
--- a/piuparts-slave.py
+++ b/piuparts-slave.py
@@ -91,6 +91,13 @@ class Alarm(Exception):
def alarm_handler(signum, frame):
raise Alarm
+
+class MasterIsBusy(Exception):
+
+ def __init__(self):
+ self.args = "Master is busy, retry later"
+
+
class MasterNotOK(Exception):
def __init__(self):
@@ -160,6 +167,8 @@ class Slave:
self._to_master = p.stdin
self._from_master = p.stdout
line = self._readline()
+ if line == "busy\n":
+ raise MasterIsBusy()
if line != "hello\n":
raise MasterDidNotGreet()
logging.debug("Connected to master")
@@ -306,6 +315,9 @@ class Section:
self._slave.connect_to_master(self._log_file)
except KeyboardInterrupt:
raise
+ except MasterIsBusy:
+ logging.error("master is busy")
+ return 0
except:
logging.error("connection to master failed")
return 0
--
piuparts git repository
More information about the Piuparts-commits
mailing list