[Piuparts-commits] [SCM] piuparts git repository branch, piatti, updated. 0.45-75-g5fca52d
Andreas Beckmann
debian at abeckmann.de
Thu Jul 26 12:13:32 UTC 2012
The following commit has been merged in the piatti branch:
commit 63fb94fde5f01ab69c35dfa624a27dce0d548910
Author: Andreas Beckmann <debian at abeckmann.de>
Date: Sat Jul 7 23:18:07 2012 +0200
p-s: raise MasterCommunicationFailed if connection gets lost
Do not crash if the connection to the master gets lost later on
(master process crashed, network problem, ...).
Catch the IOError in the ssh connection and re-raise as
MasterCommunicationFailed.
Signed-off-by: Andreas Beckmann <debian at abeckmann.de>
diff --git a/piuparts-slave.py b/piuparts-slave.py
index 5a2e7a7..cdcbb84 100644
--- a/piuparts-slave.py
+++ b/piuparts-slave.py
@@ -124,6 +124,12 @@ class MasterDidNotGreet(Exception):
self.args = "Master did not start with 'hello'"
+class MasterCommunicationFailed(Exception):
+
+ def __init__(self):
+ self.args = "Communication with master failed"
+
+
class MasterIsCrazy(Exception):
def __init__(self):
@@ -141,15 +147,21 @@ class Slave:
self._master_command = None
def _readline(self):
- line = self._from_master.readline()
+ try:
+ line = self._from_master.readline()
+ except IOError:
+ raise MasterCommunicationFailed()
logging.debug("<< " + line.rstrip())
return line
def _writeline(self, *words):
line = " ".join(words)
logging.debug(">> " + line)
- self._to_master.write(line + "\n")
- self._to_master.flush()
+ try:
+ self._to_master.write(line + "\n")
+ self._to_master.flush()
+ except IOError:
+ raise MasterCommunicationFailed()
def set_master_host(self, host):
logging.debug("Setting master host to %s" % host)
--
piuparts git repository
More information about the Piuparts-commits
mailing list