public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* cluster: STABLE3 - fence: Fix virsh agent and ssh_options in case of ssh private key
@ 2009-01-06 15:08 Jan Friesse
  0 siblings, 0 replies; only message in thread
From: Jan Friesse @ 2009-01-06 15:08 UTC (permalink / raw)
  To: cluster-cvs-relay

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=99551d0e52aa23e37f32516d9b980640544cb7eb
Commit:        99551d0e52aa23e37f32516d9b980640544cb7eb
Parent:        01d7e0764edc194d7215f5fc16c24f55c51a3755
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:07:17 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 11e8bca..4393b97 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -559,7 +559,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 d54478d..bdf4e88 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)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-01-06 15:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-06 15:08 cluster: STABLE3 - fence: Fix virsh agent and ssh_options in case of ssh private key Jan Friesse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).