This is the mail archive of the cluster-cvs@sourceware.org mailing list for the cluster.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cluster: STABLE2 - fence: Fix virsh agent and ssh_options in case ofssh private key


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=284895aea6783be3e179b9f2119bfe07939f5e81
Commit:        284895aea6783be3e179b9f2119bfe07939f5e81
Parent:        722f9dcf697bcb93d1387b793dd5b915201fd9f0
Author:        Jan Friesse <jfriesse@redhat.com>
AuthorDate:    Tue Jan 6 16:07:17 2009 +0100
Committer:     Jan Friesse <jfriesse@redhat.com>
CommitterDate: Tue Jan 6 16:08:52 2009 +0100

fence: Fix virsh agent and ssh_options in case of ssh private key

Virsh agent should use --noprofile and --norc when invoking bash, because
in other case, all PS1 setting doesn't make any sense.

fencing.py.py library have two branches for invoking ssh command. One
case is without ssh private key and other is with it. Case without
private key process ssh_options agent key, but other branch not.
This patch fixes that and now both branches behave correctly.
---
 fence/agents/lib/fencing.py.py    |    6 +++++-
 fence/agents/virsh/fence_virsh.py |    2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 07aa51f..dc891ae 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -425,7 +425,11 @@ def fence_login(options):
 			conn.sendline(options["-p"])
 			conn.log_expect(options, options["-c"], LOGIN_TIMEOUT)
 		elif options.has_key("-x") and 1 == options.has_key("-k"):
-			conn = fspawn('%s %s@%s -i %s' % (SSH_PATH, options["-l"], options["-a"], options["-k"]))
+			command = '%s %s@%s -i %s' % (SSH_PATH, options["-l"], options["-a"], options["-k"])
+			if options.has_key("ssh_options"):
+				command += ' ' + options["ssh_options"]
+			conn = fspawn(command)
+
 			result = conn.log_expect(options, [ options["-c"], "Are you sure you want to continue connecting (yes/no)?", "Enter passphrase for key '"+options["-k"]+"':" ], LOGIN_TIMEOUT)
 			if result == 1:
 				conn.sendline("yes")
diff --git a/fence/agents/virsh/fence_virsh.py b/fence/agents/virsh/fence_virsh.py
index 3058087..7387d11 100644
--- a/fence/agents/virsh/fence_virsh.py
+++ b/fence/agents/virsh/fence_virsh.py
@@ -72,7 +72,7 @@ def main():
 
 	options["-x"]=1
 
-	options["ssh_options"]="-t '/bin/bash -c \"PS1=\[EXPECT\]#\  /bin/bash\"'"
+	options["ssh_options"]="-t '/bin/bash -c \"PS1=\[EXPECT\]#\  /bin/bash --noprofile --norc\"'"
 
 	## Operate the fencing device
 	conn = fence_login(options)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]