Blob Blame History Raw
From ea8cc4949d562b75822d9362808cf3d333fb6d92 Mon Sep 17 00:00:00 2001
From: Marek 'marx' Grac <mgrac@redhat.com>
Date: Mon, 14 Sep 2015 13:27:45 +0200
Subject: [PATCH] fence_apc: Support for v6.x firmware

There are no changes in interface, so it is enough to accept new version number.
Login process over telnet has changed a bit and autodection of EOL did not work properly. Relevant part
of changed so it work correctly when after empty 'User Name', the device ask for it again.

Resolves: rhbz#1259319
---
 fence/agents/apc/fence_apc.py  | 2 +-
 fence/agents/lib/fencing.py.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
index 83bfe07..b77d36e 100644
--- a/fence/agents/apc/fence_apc.py
+++ b/fence/agents/apc/fence_apc.py
@@ -247,7 +247,7 @@ will block any necessary fencing actions."
 	####
 	result = -1
 	firmware_version = re.compile(r'\s*v(\d)*\.').search(conn.before)
-	if (firmware_version != None) and (firmware_version.group(1) == "5"):
+	if (firmware_version != None) and (firmware_version.group(1) in [ "5", "6" ]):
 		result = fence_action(conn, options, set_power_status5, get_power_status5, get_power_status5)
 	else:
 		result = fence_action(conn, options, set_power_status, get_power_status, get_power_status)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 7fddc47..fe602a5 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -1153,7 +1153,7 @@ def fence_login(options, re_login_string=r"(login\s*: )|(Login Name:  )|(usernam
 					conn.send_eol("")
 					screen = conn.read_nonblocking(size=100, timeout=int(options["--shell-timeout"]))
 					## after sending EOL the fence device can either show 'Login' or 'Password'
-					if re_login.search(screen) != None:
+					if re_login.search(conn.after + screen) != None:
 						conn.send_eol("")
 					conn.send_eol(options["--username"])
 					conn.log_expect(options, re_pass, int(options["--login-timeout"]))
-- 
2.4.3