fence-agents: master - fence_apc: fence_apc fails for some port numbers

Fabio M. Di Nitto fabbione at fedoraproject.org
Mon Jul 5 10:42:23 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=commitdiff;h=dbd626380161c464a7b6813fbe125da712678f4b
Commit:        dbd626380161c464a7b6813fbe125da712678f4b
Parent:        6cb492f23d8507880d745be9dbbf3c30c38969fa
Author:        Marek 'marx' Grac <mgrac at redhat.com>
AuthorDate:    Wed Jun 23 18:29:02 2010 +0200
Committer:     Fabio M. Di Nitto <fdinitto at redhat.com>
CommitterDate: Mon Jul 5 12:42:04 2010 +0200

fence_apc: fence_apc fails for some port numbers

Problem is that string we parse looks like:
'Press Enter to continue ...\r 23-bar1 ON' and we did not expect text
message before our line.

Resolves: #606297
---
 fence/agents/apc/fence_apc.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
index 12ddf2a..d10dd5f 100755
--- a/fence/agents/apc/fence_apc.py
+++ b/fence/agents/apc/fence_apc.py
@@ -70,11 +70,11 @@ def get_power_status(conn, options):
 		while True:
 			exp_result = conn.log_expect(options, [ options["-c"],  "Press <ENTER>" ], int(options["-Y"]))
 			lines = conn.before.split("\n");
-			show_re = re.compile('^\s*(\d+)- (.*?)\s+(ON|OFF)\s*')
+			show_re = re.compile('(^|\x0D)\s*(\d+)- (.*?)\s+(ON|OFF)\s*')
 			for x in lines:
 				res = show_re.search(x)
 				if (res != None):
-					outlets[res.group(1)] = (res.group(2), res.group(3))
+					outlets[res.group(2)] = (res.group(3), res.group(4))
 			conn.send("\r\n")
 			if exp_result == 0:
 				break


More information about the cluster-commits mailing list