fence-agents: RHEL6 - fencing: Missing password is not reported properly
Marek GrĂ¡c
marx at fedoraproject.org
Wed Feb 8 16:22:26 UTC 2012
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=1170dcaa2632b40df04e8f655ffa1b0eb22000ad
Commit: 1170dcaa2632b40df04e8f655ffa1b0eb22000ad
Parent: 8a2a70414d7e287f801d31d7b89c9a1de269f936
Author: Marek 'marx' Grac <mgrac at redhat.com>
AuthorDate: Mon Jan 30 15:56:51 2012 +0100
Committer: Marek 'marx' Grac <mgrac at redhat.com>
CommitterDate: Mon Jan 30 15:56:51 2012 +0100
fencing: Missing password is not reported properly
When username is entered and password is missing then it is possible
that fence code will end with exception.
Resolves: rhbz#785091
---
fence/agents/lib/fencing.py.py | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 8be0a61..e93f59a 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -25,6 +25,7 @@ EC_WAITING_ON = 6
EC_WAITING_OFF = 7
EC_STATUS = 8
EC_STATUS_HMC = 9
+EC_PASSWORD_MISSING = 10
TELNET_PATH = "/usr/bin/telnet"
SSH_PATH = "/usr/bin/ssh"
@@ -439,7 +440,8 @@ def fail(error_code):
EC_WAITING_ON : "Failed: Timed out waiting to power ON",
EC_WAITING_OFF : "Failed: Timed out waiting to power OFF",
EC_STATUS : "Failed: Unable to obtain correct plug status or plug is not available",
- EC_STATUS_HMC : "Failed: Either unable to obtaion correct plug status, partition is not available or incorrect HMC version used"
+ EC_STATUS_HMC : "Failed: Either unable to obtaion correct plug status, partition is not available or incorrect HMC version used",
+ EC_PASSWORD_MISSING : "Failed: You have to set login password"
}[error_code] + "\n"
sys.stderr.write(message)
sys.exit(EC_GENERIC_ERROR)
@@ -946,8 +948,11 @@ def fence_login(options):
conn.log_expect(options, re_login, int(options["-y"]))
conn.send(options["-l"] + login_eol)
conn.log_expect(options, re_pass, int(options["-Y"]))
- conn.send(options["-p"] + login_eol)
- conn.log_expect(options, options["-c"], int(options["-Y"]))
+ try:
+ conn.send(options["-p"] + login_eol)
+ conn.log_expect(options, options["-c"], int(options["-Y"]))
+ except KeyError:
+ fail(EC_PASSWORD_MISSING)
except pexpect.EOF:
fail(EC_LOGIN_DENIED)
except pexpect.TIMEOUT:
More information about the cluster-commits
mailing list