Cluster Project branch, STABLE2, updated. cluster-2.03.02-23-g96097de
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project".
The branch, STABLE2 has been updated
via 96097ded9fd289d90aedc22262d9bbe8e20af3a5 (commit)
from dc6c5bc67acb54b8db4826df04678b0359b02dc1 (commit)Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit 96097ded9fd289d90aedc22262d9bbe8e20af3a5
Author: Marek 'marx' Grac <[email protected]> Date: Mon May 19 17:28:39 2008 +0200
[FENCE] Fix #248609: SSH support in Bladecenter fencing (ssh)
Complete ssh support for Bladecenter. You can use password or private key (identity_file on STDIN; -k in getopt) to login to system. This patch contains complete infrastructure (usable also by other agents).
-----------------------------------------------------------------------
Summary of changes:
fence/agents/bladecenter/fence_bladecenter.py | 2 +- fence/agents/lib/fencing.py.py | 40 ++++++++++++++++++++----- 2 files changed, 33 insertions(+), 9 deletions(-)
fence/agents/bladecenter/fence_bladecenter.py +1 -1
@@ -64,7 +64,7 @@ def set_power_status(conn, options): def main(): device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug", "action", "ipaddr", "login", "passwd", "passwd_script", - "cmd_prompt", "secure", "port" ] + "cmd_prompt", "secure", "port", "identity_file" ] options = check_input(device_opt, process_input(device_opt))
fence/agents/lib/fencing.py.py +32 -8
@@ -72,12 +72,16 @@ all_opt = { "order" : 1 }, "passwd" : { "getopt" : "p:", - "help" : "-p <password> Login password", + "help" : "-p <password> Login password or passphrase", "order" : 1 }, "passwd_script" : { "getopt" : "S:", "help" : "-S <script> Script to run to retrieve password", "order" : 1 }, + "identity_file" : { + "getopt" : "k:", + "help" : "-k <filename> Identity file (private key) for ssh ", + "order" : 1 }, "module_name" : { "getopt" : "m:", "help" : "-m <module> DRAC/MC module name",
@@ -254,11 +258,19 @@ def check_input(device_opt, opt): if 0 == options.has_key("-a"): fail_usage("Failed: You have to enter fence address") - if 0 == (options.has_key("-p") or options.has_key("-S")): - fail_usage("Failed: You have to enter password or password script") + if 0 == device_opt.count("identity_file"): + if 0 == (options.has_key("-p") or options.has_key("-S")): + fail_usage("Failed: You have to enter password or password script") + else: + if 0 == (options.has_key("-p") or options.has_key("-S") or options.has_key("-k")): + fail_usage("Failed: You have to enter password, password script or identity file") + + if 0 == options.has_key("-x") and 1 == options.has_key("-k"): + fail_usage("Failed: You have to use identity file together with ssh connection (-x)") - if 1 == (options.has_key("-p") and options.has_key("-S")): - fail_usage("Failed: You have to enter password or password script") + if 1 == options.has_key("-k"): + if 0 == os.path.isfile(options["-k"]): + fail_usage("Failed: Identity file " + options["-k"] + " does not exist") if (0 == options.has_key("-n")) and (device_opt.count("port")): fail_usage("Failed: You have to enter plug number")
@@ -325,14 +337,26 @@ def fence_login(options): re_login = re.compile("(login: )|(Login Name: )|(username: )|(User Name :)", re.IGNORECASE) re_pass = re.compile("password", re.IGNORECASE) - if options.has_key("-x"): + if options.has_key("-x") and 0 == options.has_key("-k"): conn = fspawn ('ssh ' + options["-l"] + "@" + options["-a"]) - result = conn.log_expect(options, [ "ssword: ", "Are you sure you want to continue connecting (yes/no)?" ], LOGIN_TIMEOUT) + result = conn.log_expect(options, [ "ssword:", "Are you sure you want to continue connecting (yes/no)?" ], LOGIN_TIMEOUT) if result == 1: conn.sendline("yes") - conn.log_expect(options, "ssword: ", SHELL_TIMEOUT) + conn.log_expect(options, "ssword:", SHELL_TIMEOUT) conn.sendline(options["-p"]) conn.log_expect(options, options["-c"], SHELL_TIMEOUT) + elif options.has_key("-x") and 1 == options.has_key("-k"): + conn = fspawn ('ssh ' + options["-l"] + "@" + options["-a"] + " -i " + options["-k"]) + 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") + conn.log_expect(options, [ options["-c"], "Enter passphrase for key '"+options["-k"]+"':"] , SHELL_TIMEOUT) + if result != 0: + if options.has_key("-p"): + conn.sendline(options["-p"]) + conn.log_expect(options, options["-c"], SHELL_TIMEOUT) + else: + fail_usage("Failed: You have to enter passphrase (-p) for identity file") else: conn = fspawn ('telnet ' + options["-a"]) conn.log_expect(options, re_login, LOGIN_TIMEOUT)
hooks/post-receive
--
Cluster Project