This is the mail archive of the cluster-cvs@sourceware.org mailing list for the cluster.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cluster: RHEL5 - fencing.py: Adds device option login_eol_lf


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=c0a0ac5b6358a0f641a1d5e739307e7957e7ba6a
Commit:        c0a0ac5b6358a0f641a1d5e739307e7957e7ba6a
Parent:        405b0dfc7f2c6956560b19e99b6441b24983afbc
Author:        Marek 'marx' Grac <mgrac@redhat.com>
AuthorDate:    Tue Jul 21 14:48:51 2009 +0200
Committer:     Marek 'marx' Grac <mgrac@redhat.com>
CommitterDate: Tue Jul 21 14:55:44 2009 +0200

fencing.py: Adds device option login_eol_lf

This option is used for login method using telnet. By default most of the fence agents
work with username\r\n but on some devices (e.g. HP iLO MP, sanbox2) it is interpreted
as there is empty password.

Needed for bz#512947 (sanbox2) and #508722 (fence_ilo-mp)
---
 fence/agents/lib/fencing.py.py |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 8175048..480150b 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -116,6 +116,11 @@ all_opt = {
 		"getopt" : "r:",
 		"help" : "-r <version>   Force ribcl version to use",
 		"order" : 1 },
+	"login_eol_lf" : {
+		"getopt" : "",
+		"help" : "",
+		"order" : 1
+		},
 	"cmd_prompt" : {
 		"getopt" : "c:",
 		"help" : "-c <prompt>    Force command prompt",
@@ -454,6 +459,11 @@ def fence_action(tn, options, set_power_fn, get_power_fn):
 		print "Status: " + status.upper()
 
 def fence_login(options):
+	if (options["device_opt"].count("login_eol_lf")):
+		login_eol = "\n"
+	else:
+		login_eol = "\r\n"
+
 	try:
 		re_login = re.compile("(login: )|(Login Name:  )|(username: )|(User Name :)", re.IGNORECASE)
 		re_pass  = re.compile("password", re.IGNORECASE)
@@ -517,9 +527,9 @@ def fence_login(options):
 				sys.exit(EC_GENERIC_ERROR)
 
 			conn.log_expect(options, re_login, LOGIN_TIMEOUT)
-			conn.send(options["-l"]+"\r\n")
+			conn.send(options["-l"] + login_eol)
 			conn.log_expect(options, re_pass, SHELL_TIMEOUT)
-			conn.send(options["-p"]+"\r\n")
+			conn.send(options["-p"] + login_eol)
 			conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
 	except pexpect.EOF:
 		fail(EC_LOGIN_DENIED) 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]