From e0e7e3dd735bdecae01947e272c4e9025b6393cc Mon Sep 17 00:00:00 2001 From: Marek 'marx' Grac <mgrac@redhat.com> Date: Wed, 23 Jun 2010 18:29:02 +0200 Subject: [PATCH] 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: #606315 --- 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 1aa7bed..0a3ce58 100755 --- a/fence/agents/apc/fence_apc.py +++ b/fence/agents/apc/fence_apc.py @@ -71,11 +71,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 -- 1.6.0.6