public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
From: "Marek Grác" <marx@fedoraproject.org>
To: cluster-cvs-relay@redhat.com
Subject: fence-agents: master - fencing.py: Adds device option login_eol_lf
Date: Tue, 21 Jul 2009 13:49:00 -0000	[thread overview]
Message-ID: <20090721134902.867EF1201B5@lists.fedorahosted.org> (raw)

Gitweb:        http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=commitdiff;h=0b2b6e5f5ccae39d5f8931ee6d222164198534ec
Commit:        0b2b6e5f5ccae39d5f8931ee6d222164198534ec
Parent:        06a1e2735127c38b5d28875f881ec8f8cac47879
Author:        Marek 'marx' Grac <mgrac@redhat.com>
AuthorDate:    Tue Jul 21 15:44:07 2009 +0200
Committer:     Marek 'marx' Grac <mgrac@redhat.com>
CommitterDate: Tue Jul 21 15:44:07 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.
---
 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 6a2e8b3..2d0205d 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -157,6 +157,11 @@ all_opt = {
 		"required" : "0",
 		"shortdesc" : "Force ribcl version to use",
 		"order" : 1 },
+	"login_eol_lf" : {
+		"getopt" : "",
+		"help" : "",
+		"order" : 1
+		},
 	"cmd_prompt" : {
 		"getopt" : "c:",
 		"longopt" : "command-prompt",
@@ -701,6 +706,11 @@ def fence_login(options):
 	if (options.has_key("-4")):
 		force_ipvx="-4 "
 
+	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)
@@ -776,9 +786,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) 


                 reply	other threads:[~2009-07-21 13:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090721134902.867EF1201B5@lists.fedorahosted.org \
    --to=marx@fedoraproject.org \
    --cc=cluster-cvs-relay@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).