Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 893b4547bb5f5eb61d2f3af4281e5a38 > files > 83

cman-2.0.115-96.el5_8.1.src.rpm

From f8b840263319b6c8dbe0b8f093f729c4ecac7b2d Mon Sep 17 00:00:00 2001
From: Marek 'marx' Grac <mgrac@redhat.com>
Date: Wed, 11 Nov 2009 13:20:34 +0100
Subject: [PATCH] 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)
 
-- 
1.6.0.6