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

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)


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

only message in thread, other threads:[~2009-01-06 15:10 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:10 cluster: STABLE2 - 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).