From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4875 invoked by alias); 26 Jun 2009 11:39:38 -0000 Received: (qmail 4868 invoked by alias); 26 Jun 2009 11:39:38 -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: fence-agents: master - fence_wti: Fence agent for WTI ends with traceback when option is missing To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: fence-agents.git X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: d35a9f675801ba1926a98b1f074ee5445560fa91 X-Git-Newrev: b0913e9ff4b7a2be3895577ae5d54d44a6bfb067 From: =?utf-8?q?Marek_Gr=C3=A1c?= Message-Id: <20090626113900.BB1211201EE@lists.fedorahosted.org> Date: Fri, 26 Jun 2009 11:39: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-q2/txt/msg00775.txt.bz2 Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=commitdiff;h=b0913e9ff4b7a2be3895577ae5d54d44a6bfb067 Commit: b0913e9ff4b7a2be3895577ae5d54d44a6bfb067 Parent: d35a9f675801ba1926a98b1f074ee5445560fa91 Author: Marek 'marx' Grac AuthorDate: Fri Jun 26 13:34:15 2009 +0200 Committer: Marek 'marx' Grac CommitterDate: Fri Jun 26 13:34:15 2009 +0200 fence_wti: Fence agent for WTI ends with traceback when option is missing Login name/password are NOT required for WTI, so they have to be checked after login/password is encountered. Please enter the commit message for your changes. bz#508262 --- fence/agents/wti/fence_wti.py | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py index 9f5d59f..35b4d54 100644 --- a/fence/agents/wti/fence_wti.py +++ b/fence/agents/wti/fence_wti.py @@ -101,12 +101,18 @@ def main(): 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 options.has_key("-l"): + conn.send(options["-l"]+"\r\n") + result = conn.log_expect(options, [ re_login, "Password: ", re_prompt ], SHELL_TIMEOUT) + else: + fail_usage("Failed: You have to set login name") if result == 1: - conn.send(options["-p"]+"\r\n") - conn.log_expect(options, options["-c"], SHELL_TIMEOUT) + if options.has_key("-p"): + conn.send(options["-p"]+"\r\n") + conn.log_expect(options, options["-c"], SHELL_TIMEOUT) + else: + fail_usage("Failed: You have to enter password or password script") except pexpect.EOF: fail(EC_LOGIN_DENIED) except pexpect.TIMEOUT: