cluster: RHEL55 - fencing: Fencing fails if fence_wti is used without telnet
Marek Grác
marx at fedoraproject.org
Wed Nov 11 12:22:32 UTC 2009
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=f8b840263319b6c8dbe0b8f093f729c4ecac7b2d
Commit: f8b840263319b6c8dbe0b8f093f729c4ecac7b2d
Parent: c1d949e3ca56c288967336d3e37bc0096588d533
Author: Marek 'marx' Grac <mgrac at redhat.com>
AuthorDate: Wed Nov 11 13:20:34 2009 +0100
Committer: Marek 'marx' Grac <mgrac at redhat.com>
CommitterDate: Wed Nov 11 13:20:34 2009 +0100
fencing: Fencing fails if fence_wti is used without telnet
Better error messages as we don't ship telnet/ssh/... as dependencies.
Resolves: bz#512343
---
fence/agents/lib/fencing.py.py | 15 +++++++++++++--
fence/agents/wti/fence_wti.py | 9 ++++++++-
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 860d194..fbda2a8 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -801,7 +801,12 @@ def fence_login(options):
if options.has_key("-z"):
command = '%s %s %s %s' % (SSL_PATH, force_ipvx, options["-a"], options["-u"])
- conn = fspawn(command)
+ try:
+ conn = fspawn(command)
+ except pexpect.ExceptionPexpect, ex:
+ ## SSL telnet is part of the fencing package
+ sys.stderr.write(str(ex) + "\n")
+ sys.exit(EC_GENERIC_ERROR)
elif options.has_key("-x") and 0 == options.has_key("-k"):
command = '%s %s %s@%s -p %s' % (SSH_PATH, force_ipvx, options["-l"], options["-a"], options["-u"])
if options.has_key("ssh_options"):
@@ -835,7 +840,13 @@ def fence_login(options):
command = '%s %s %s@%s -i %s -p %s' % (SSH_PATH, force_ipvx, options["-l"], options["-a"], options["-k"], options["-u"])
if options.has_key("ssh_options"):
command += ' ' + options["ssh_options"]
- conn = fspawn(command)
+ try:
+ conn = fspawn(command)
+ except pexpect.ExceptionPexpect, ex:
+ sys.stderr.write(str(ex) + "\n")
+ sys.stderr.write("Due to limitations, binary dependencies on fence agents "
+ "are not in the spec file and must be installed separately." + "\n")
+ sys.exit(EC_GENERIC_ERROR)
result = conn.log_expect(options, [ options["-c"], "Are you sure you want to continue connecting (yes/no)?", "Enter passphrase for key '"+options["-k"]+"':" ], int(options["-y"]))
if result == 1:
diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py
index f0f02b3..888695f 100755
--- a/fence/agents/wti/fence_wti.py
+++ b/fence/agents/wti/fence_wti.py
@@ -99,7 +99,14 @@ def main():
#####
if 0 == options.has_key("-x"):
try:
- conn = fspawn ('telnet ' + options["-a"])
+ try:
+ conn = fspawn('%s %s' % (TELNET_PATH, options["-a"]))
+ except pexpect.ExceptionPexpect, ex:
+ sys.stderr.write(str(ex) + "\n")
+ sys.stderr.write("Due to limitations, binary dependencies on fence agents "
+ "are not in the spec file and must be installed separately." + "\n")
+ sys.exit(EC_GENERIC_ERROR)
+
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)
More information about the cluster-commits
mailing list