Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=3cc91f4c6... Commit: 3cc91f4c6e7aec98bd6f4e1dddaa08876ae893d0 Parent: 5c3d18b829011267a62564e2e025d2066c9cf07d Author: Marek 'marx' Grac mgrac@redhat.com AuthorDate: Sun Nov 18 01:56:35 2012 +0100 Committer: Marek 'marx' Grac mgrac@redhat.com CommitterDate: Sun Nov 25 13:06:34 2012 +0100
fencing: Add new option --ssh-options
All fence agents which supports ssh connection can use --ssh-options / ssh_options to change default ssh parameters (different cipher, config file, ...) --- fence/agents/apc/fence_apc.py | 2 +- fence/agents/lib/fencing.py.py | 17 ++++++++++++----- fence/agents/rsa/fence_rsa.py | 5 ++--- fence/agents/virsh/fence_virsh.py | 3 +-- 4 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py index 314c0aa..ed80c64 100644 --- a/fence/agents/apc/fence_apc.py +++ b/fence/agents/apc/fence_apc.py @@ -180,9 +180,9 @@ def main(): atexit.register(atexit_handler)
all_opt["cmd_prompt"]["default"] = "\n>" + all_opt["ssh_options"]["default"] = "-1 -c blowfish"
options = check_input(device_opt, process_input(device_opt)) - options["ssh_options"] = "-1 -c blowfish"
docs = { } docs["shortdesc"] = "Fence agent for APC over telnet/ssh" diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py index 61a5052..d5c67a6 100644 --- a/fence/agents/lib/fencing.py.py +++ b/fence/agents/lib/fencing.py.py @@ -184,6 +184,13 @@ all_opt = { "shortdesc" : "SSH connection", "required" : "0", "order" : 1 }, + "ssh_options" : { + "getopt" : "X:", + "longopt" : "ssh-options", + "help" : "--ssh-options=<options> SSH options to use", + "shortdesc" : "SSH options to use", + "required" : "0", + "order" : 1 }, "ssl" : { "getopt" : "z", "longopt" : "ssl", @@ -408,7 +415,7 @@ DEPENDENCY_OPT = { "default" : [ "help", "debug", "verbose", "quiet", "version", "action", "agent", \ "power_timeout", "shell_timeout", "login_timeout", "power_wait", "retry_on", "delay" ], "passwd" : [ "passwd_script" ], - "secure" : [ "identity_file" ], + "secure" : [ "identity_file", "ssh_options" ], "ipaddr" : [ "inet4_only", "inet6_only" ], "port" : [ "separator" ], "community" : [ "snmp_auth_prot", "snmp_sec_level", "snmp_priv_prot", \ @@ -942,8 +949,8 @@ def fence_login(options): sys.exit(EC_GENERIC_ERROR) elif options.has_key("--ssh") and 0 == options.has_key("--identity-file"): command = '%s %s %s@%s -p %s' % (SSH_PATH, force_ipvx, options["--username"], options["--ip"], options["--ipport"]) - if options.has_key("ssh_options"): - command += ' ' + options["ssh_options"] + if options.has_key("--ssh-options"): + command += ' ' + options["--ssh-options"] try: conn = fspawn(options, command) except pexpect.ExceptionPexpect, ex: @@ -971,8 +978,8 @@ def fence_login(options): conn.log_expect(options, options["--command-prompt"], int(options["--login-timeout"])) elif options.has_key("--ssh") and options.has_key("--identity-file"): command = '%s %s %s@%s -i %s -p %s' % (SSH_PATH, force_ipvx, options["--username"], options["--ip"], options["--identity-file"], options["--ipport"]) - if options.has_key("ssh_options"): - command += ' ' + options["ssh_options"] + if options.has_key("--ssh-options"): + command += ' ' + options["--ssh-options"] try: conn = fspawn(options, command) except pexpect.ExceptionPexpect, ex: diff --git a/fence/agents/rsa/fence_rsa.py b/fence/agents/rsa/fence_rsa.py index 14ec88f..898c6c2 100644 --- a/fence/agents/rsa/fence_rsa.py +++ b/fence/agents/rsa/fence_rsa.py @@ -40,12 +40,11 @@ def main():
all_opt["login_timeout"]["default"] = 10 all_opt["cmd_prompt"]["default"] = [ ">" ] + # This device will not allow us to login even with LANG=C + all_opt["ssh_options"]["default"] = "-F /dev/null"
options = check_input(device_opt, process_input(device_opt))
- # This device will not allow us to login even with LANG=C - options["ssh_options"] = "-F /dev/null" - docs = { } docs["shortdesc"] = "Fence agent for IBM RSA" docs["longdesc"] = "fence_rsa is an I/O Fencing agent \ diff --git a/fence/agents/virsh/fence_virsh.py b/fence/agents/virsh/fence_virsh.py index 81edf6a..d012710 100644 --- a/fence/agents/virsh/fence_virsh.py +++ b/fence/agents/virsh/fence_virsh.py @@ -66,11 +66,10 @@ def main():
all_opt["secure"]["default"] = "1" all_opt["cmd_prompt"]["default"] = [ "[EXPECT]#\ " ] + all_opt["ssh_options"]["default"] = "-t '/bin/bash -c "PS1=[EXPECT]#\ /bin/bash --noprofile --norc"'"
options = check_input(device_opt, process_input(device_opt))
- options["ssh_options"] = "-t '/bin/bash -c "PS1=[EXPECT]#\ /bin/bash --noprofile --norc"'" - docs = { } docs["shortdesc"] = "Fence agent for virsh" docs["longdesc"] = "fence_virsh is an I/O Fencing agent \
cluster-commits@lists.fedorahosted.org