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: cluster: RHEL4 - fence_wti: #485075 - fence_wti is unable to connect to (password-less) fencing device Date: Wed, 11 Feb 2009 14:31:00 -0000 [thread overview] Message-ID: <20090211143047.4CEEB120346@lists.fedorahosted.org> (raw) Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=429d9988ee05e61697d82995b25168c14c9cfdaf Commit: 429d9988ee05e61697d82995b25168c14c9cfdaf Parent: f5c4139a8d94d7ef53ffe50b2f41a5a1cd57ad4a Author: Marek 'marx' Grac <mgrac@redhat.com> AuthorDate: Wed Feb 11 15:26:14 2009 +0100 Committer: Marek 'marx' Grac <mgrac@redhat.com> CommitterDate: Wed Feb 11 15:29:07 2009 +0100 fence_wti: #485075 - fence_wti is unable to connect to (password-less) fencing device Login mechanism was completely rewritten so now we support no-loginname, no-password and possibly any other configuration. --- fence/agents/wti/fence_wti.py | 22 +++++++++++++++------- 1 files changed, 15 insertions(+), 7 deletions(-) diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py index bbfc7e5..63fa775 100755 --- a/fence/agents/wti/fence_wti.py +++ b/fence/agents/wti/fence_wti.py @@ -68,7 +68,8 @@ def set_power_status(conn, options): def main(): device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug", "action", "ipaddr", "login", "passwd", "passwd_script", - "cmd_prompt", "secure", "port", "no_login", "test" ] + "cmd_prompt", "secure", "port", "no_login", "no_password", + "test" ] options = check_input(device_opt, process_input(device_opt)) @@ -81,15 +82,22 @@ def main(): ## ## Operate the fencing device ## - ## @note: if there is not a login name then we assume that it is WTI-IPS - ## where no login name is used + ## @note: if it possible that this device does not need either login, password or both of them ##### - if (0 == options.has_key("-l")): + if 0 == options.has_key("-x"): try: conn = fspawn ('telnet ' + options["-a"]) - conn.log_expect(options, "Password: ", SHELL_TIMEOUT) - conn.send(options["-p"]+"\r\n") - conn.log_expect(options, options["-c"], SHELL_TIMEOUT) + re_login = re.compile("(login: )|(Login Name: )|(username: )|(User Name :)", re.IGNORECASE) + re_prompt = re.compile("|".join(map (lambda x: "(" + x + ")", options["-c"])), re.IGNORECASE) + + result = conn.log_expect(options, [ re_login, "Password: ", re_prompt ], SHELL_TIMEOUT) + if result == 0: + conn.send(options["-l"]+"\r\n") + result = conn.log_expect(options, [ re_login, "Password: ", re_prompt ], SHELL_TIMEOUT) + + if result == 1: + conn.send(options["-p"]+"\r\n") + conn.log_expect(options, options["-c"], SHELL_TIMEOUT) except pexpect.EOF: fail(EC_LOGIN_DENIED) except pexpect.TIMEOUT:
reply other threads:[~2009-02-11 14:31 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=20090211143047.4CEEB120346@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: linkBe 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).