Gitweb:
http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 3bc496c348bbb3e0fe2448ae09c7265c9da14ada
Parent: 840cd254516025031f1005c9b5b34e1ea2142990
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Sun Dec 20 18:28:26 2009 +0100
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Sun Dec 20 18:28:26 2009 +0100
fencing: Fence agent for RSB ends with traceback
RSB changed so it don't print 'CLOSING CONNECTION' and 'Power
status:'
was changed to 'Power status :'
Resolves: rhbz#545054
---
fence/agents/rsb/fence_rsb.py | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/fence/agents/rsb/fence_rsb.py b/fence/agents/rsb/fence_rsb.py
index 1f5592e..25a2826 100755
--- a/fence/agents/rsb/fence_rsb.py
+++ b/fence/agents/rsb/fence_rsb.py
@@ -73,6 +73,8 @@ def main():
standard_err = 2
+ completed_action = 0
+
#set up regex list
USERNAME = 0
PASSWORD = 1
@@ -87,7 +89,7 @@ def main():
regex_list.append("user name\s*:")
regex_list.append("pass phrase\s*:")
regex_list.append("[Ee]nter\s+[Ss]election[^\r\n]*:")
- regex_list.append("[pP]ower Status:")
+ regex_list.append("[pP]ower Status\s*:")
regex_list.append("[Ee]rror\s*:")
regex_list.append("[Pp]ress any key to continue")
regex_list.append("really want to")
@@ -274,7 +276,15 @@ def main():
sock.close()
sys.exit(1)
- buf = sock.read_eager()
+ try:
+ buf = sock.read_eager()
+ except EOFError:
+ if completed_action == 1:
+ # action was completed succesfully, connection closed is OK
+ sys.exit(result)
+ else:
+ raise
+
if i == USERNAME:
if verbose:
print "Sending login: %s\n" % login
@@ -315,6 +325,7 @@ def main():
if verbose:
print "Power off was successful"
if action == POWER_OFF:
+ completed_action = 1
depth += 1
sock.write("0\r")
else:
@@ -342,6 +353,7 @@ def main():
elif power_command_issued and power_state == 1:
if verbose:
print "Power on was successful"
+ completed_action = 1
depth += 1
sock.write("0\r")
elif tries > 0:
@@ -376,6 +388,7 @@ def main():
os.write(standard_err, ("FENCE: Cannot determine power state: %s" %
buf))
sys.exit(1)
depth = 2
+ completed_action = 1
elif i == DONE:
break