fence-agents: master - fencing: Issue with login when autodetection of EOL is used

Marek GrĂ¡c marx at fedoraproject.org
Tue Nov 12 14:11:15 UTC 2013


Gitweb:        http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=a6d0dfb6dfcfe0bdedf79ab95df9a3e9d7623700
Commit:        a6d0dfb6dfcfe0bdedf79ab95df9a3e9d7623700
Parent:        eb546e504e720bd97258a70ef96e4e51e5778009
Author:        Marek 'marx' Grac <mgrac at redhat.com>
AuthorDate:    Tue Nov 12 15:05:33 2013 +0100
Committer:     Marek 'marx' Grac <mgrac at redhat.com>
CommitterDate: Tue Nov 12 15:05:33 2013 +0100

fencing: Issue with login when autodetection of EOL is used

When fence agent attempts to login to fence device it tries to find out proper EOL. During tests
on the new fence device (Dell DRAC MC) we have found two minor problems which are fixed in this commit:

1) Regular expression for expected login prompt was case sensitive previously

2) Expectation that after pressing ENTER we will obtain sequence:
  login prompt, password prompt, login prompt, password prompt, ...
was found to be incorrect as this fence device shows password prompt only when login prompt was not empty
---
 fence/agents/lib/fencing.py.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index b2ab4be..0ef0934 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -1012,12 +1012,15 @@ def fence_login(options, re_login_string = "(login\s*: )|(Login Name:  )|(userna
 
 			try:
 				conn.send_eol(options["--password"])
-				valid_password = conn.log_expect(options, [ re_login_string ] + options["--command-prompt"], int(options["--shell-timeout"]))
+				valid_password = conn.log_expect(options, [ re_login ] + options["--command-prompt"], int(options["--shell-timeout"]))
 				if valid_password == 0:
 					## password is invalid or we have to change EOL separator
 					options["eol"] = "\r"
 					conn.send_eol("")
-					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):
+						conn.send_eol("")
 					conn.send_eol(options["--username"])
 					conn.log_expect(options, re_pass, int(options["--login-timeout"]))
 					conn.send_eol(options["--password"])


More information about the cluster-commits mailing list