fence-agents: RHEL6 - fence_apc: Improve detection of EOL during login
Marek GrĂ¡c
marx at fedoraproject.org
Mon Aug 12 14:33:23 UTC 2013
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=e91f58c8a4a69f0a13b0fd388f90458ec91c68df
Commit: e91f58c8a4a69f0a13b0fd388f90458ec91c68df
Parent: 56804537d2153c22e7ee9a7fede3c20e4e19d20a
Author: Marek 'marx' Grac <mgrac at redhat.com>
AuthorDate: Mon Aug 12 16:32:29 2013 +0200
Committer: Marek 'marx' Grac <mgrac at redhat.com>
CommitterDate: Mon Aug 12 16:32:29 2013 +0200
fence_apc: Improve detection of EOL during login
Resolves: rhbz#886614
---
fence/agents/lib/fencing.py.py | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index ad5f4db..0316b58 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -879,7 +879,8 @@ def fence_login(options):
time.sleep(int(options["-f"]))
try:
- re_login = re.compile("(login\s*: )|(Login Name: )|(username: )|(User Name :)", re.IGNORECASE)
+ re_login_string = "(login\s*: )|(Login Name: )|(username: )|(User Name :)"
+ re_login = re.compile(re_login_string, re.IGNORECASE)
re_pass = re.compile("(password)|(pass phrase)", re.IGNORECASE)
if options.has_key("-z"):
@@ -966,7 +967,20 @@ def fence_login(options):
try:
conn.send_eol(options["-p"])
- conn.log_expect(options, options["-c"], int(options["-Y"]))
+
+ if type(options["-c"]) is not list:
+ options["-c"] = [ options["-c"] ]
+
+ valid_password = conn.log_expect(options, [ re_login_string ] + options["-c"], int(options["-Y"]))
+ if valid_password == 0:
+ ## password is invalid or we have to change EOL separator
+ options["eol"] = "\r"
+ conn.send_eol("")
+ conn.send_eol("")
+ conn.send_eol(options["-l"])
+ conn.log_expect(options, re_pass, int(options["-y"]))
+ conn.send_eol(options["-p"])
+ conn.log_expect(options, options["-c"], int(options["-y"]))
except KeyError:
fail(EC_PASSWORD_MISSING)
except pexpect.EOF:
More information about the cluster-commits
mailing list