From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17734 invoked by alias); 21 Jul 2009 12:59:46 -0000 Received: (qmail 17726 invoked by alias); 21 Jul 2009 12:59:46 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Check-By: sourceware.org X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bastion2.fedora.phx.redhat.com Subject: cluster: RHEL4 - fencing.py: Adds device option login_eol_lf To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: cluster.git X-Git-Refname: refs/heads/RHEL4 X-Git-Reftype: branch X-Git-Oldrev: 770a87c873cb64d9e08425f9ffaf9c598effa113 X-Git-Newrev: ff9305a4c0522fdf4ec71d4516fc8f1b3070d4af From: =?utf-8?q?Marek_Gr=C3=A1c?= Message-Id: <20090721125858.3F8EF1201B5@lists.fedorahosted.org> Date: Tue, 21 Jul 2009 12:59:00 -0000 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2009-q3/txt/msg00063.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=ff9305a4c0522fdf4ec71d4516fc8f1b3070d4af Commit: ff9305a4c0522fdf4ec71d4516fc8f1b3070d4af Parent: 770a87c873cb64d9e08425f9ffaf9c598effa113 Author: Marek 'marx' Grac AuthorDate: Tue Jul 21 14:48:51 2009 +0200 Committer: Marek 'marx' Grac CommitterDate: Tue Jul 21 14:52:21 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#510279 (sanbox2) and #512941 (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 0210ec3..3e9bfd4 100644 --- a/fence/agents/lib/fencing.py.py +++ b/fence/agents/lib/fencing.py.py @@ -110,6 +110,11 @@ all_opt = { "getopt" : "r:", "help" : "-r Force ribcl version to use", "order" : 1 }, + "login_eol_lf" : { + "getopt" : "", + "help" : "", + "order" : 1 + }, "cmd_prompt" : { "getopt" : "c:", "help" : "-c Force command prompt", @@ -372,6 +377,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) @@ -433,9 +443,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)