Blob Blame History Raw
From 0981cfd54d6dbfb0bf5af536ed2c77b0594f13bb Mon Sep 17 00:00:00 2001
From: Marek 'marx' Grac <mgrac@redhat.com>
Date: Wed, 28 Aug 2013 14:17:04 +0200
Subject: [PATCH 6/6] fence_bladecenter: Fix telnet login failure

Problem occured due to fact that welcome message contains string which looks like login prompt.

Resolves: rhbz#997416
---
 fence/agents/bladecenter/fence_bladecenter.py |    2 +-
 fence/agents/lib/fencing.py.py                |    5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/fence/agents/bladecenter/fence_bladecenter.py b/fence/agents/bladecenter/fence_bladecenter.py
index e199dee..40d7136 100644
--- a/fence/agents/bladecenter/fence_bladecenter.py
+++ b/fence/agents/bladecenter/fence_bladecenter.py
@@ -100,7 +100,7 @@ and uses the command line interface to power on and off blades."
 	##
 	## Operate the fencing device
 	######
-	conn = fence_login(options)
+	conn = fence_login(options, "(username: )")
 	result = fence_action(conn, options, set_power_status, get_power_status, get_blades_list)
 
 	##
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index c896e90..2131d6d 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -950,8 +950,8 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
 	
 	return result
 
-def fence_login(options):
-	force_ipvx = ""
+def fence_login(options, re_login_string = "(login\s*: )|(Login Name:  )|(username: )|(User Name :)"):
+	force_ipvx=""
 
 	if (options.has_key("--inet6-only")):
 		force_ipvx = "-6 "
@@ -971,7 +971,6 @@ def fence_login(options):
 		time.sleep(int(options["--delay"]))
 
 	try:
-		re_login_string = "(login\s*: )|(Login Name:  )|(username: )|(User Name :)"
 		re_login = re.compile(re_login_string, re.IGNORECASE)
 		re_pass  = re.compile("(password)|(pass phrase)", re.IGNORECASE)
 
-- 
1.7.7.6