fence-agents: master - fence: RSB fence agents changed interface a bit
Marek Grác
marx at fedoraproject.org
Mon Dec 7 14:00:46 UTC 2009
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=commitdiff;h=f017f43809c6f3243bb17b66abff243d42b660c8
Commit: f017f43809c6f3243bb17b66abff243d42b660c8
Parent: 5ede119b38f05edbb832ecd33f2572220dab9637
Author: Marek 'marx' Grac <mgrac at redhat.com>
AuthorDate: Mon Dec 7 14:58:04 2009 +0100
Committer: Marek 'marx' Grac <mgrac at redhat.com>
CommitterDate: Mon Dec 7 15:00:00 2009 +0100
fence: RSB fence agents changed interface a bit
RSB changed so it don't print 'CLOSING CONNECTION' and 'Power status:' was
changed to 'Power status :'
Resolves: bz#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 77ac26b..8397f36 100644
--- a/fence/agents/rsb/fence_rsb.py
+++ b/fence/agents/rsb/fence_rsb.py
@@ -74,6 +74,8 @@ def main():
result = 0
+ completed_action = 0
+
#set up regex list
USERNAME = 0
PASSWORD = 1
@@ -88,7 +90,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")
@@ -277,7 +279,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
@@ -318,6 +328,7 @@ def main():
if verbose:
print "Power off was successful"
if action == POWER_OFF:
+ completed_action = 1
depth += 1
sock.write("0\r")
else:
@@ -345,6 +356,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:
@@ -381,6 +393,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
More information about the cluster-commits
mailing list