public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* master - fence: Added support for no_password in fence agents library and fence_eps.
@ 2008-10-22 14:21 Jan Friesse
0 siblings, 0 replies; only message in thread
From: Jan Friesse @ 2008-10-22 14:21 UTC (permalink / raw)
To: cluster-cvs-relay
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=d57145f52761f3cbd7574a988906f3315ca53cca
Commit: d57145f52761f3cbd7574a988906f3315ca53cca
Parent: 82a83ab1e9253d3784333da9279713bec25f0a8b
Author: Jan Friesse <jfriesse@redhat.com>
AuthorDate: Wed Oct 22 16:19:52 2008 +0200
Committer: Jan Friesse <jfriesse@redhat.com>
CommitterDate: Wed Oct 22 16:19:52 2008 +0200
fence: Added support for no_password in fence agents library and fence_eps.
Some fence devices don't need login name and password for fencing (this
is generally bad idea, but ePowerSwitch 8M+ is good example).
---
fence/agents/eps/fence_eps.py | 23 ++++++++++-------------
fence/agents/lib/fencing.py.py | 17 +++++++++++------
2 files changed, 21 insertions(+), 19 deletions(-)
diff --git a/fence/agents/eps/fence_eps.py b/fence/agents/eps/fence_eps.py
index c91d5af..f3b7f15 100644
--- a/fence/agents/eps/fence_eps.py
+++ b/fence/agents/eps/fence_eps.py
@@ -23,8 +23,6 @@ def eps_log(options,str):
# @param options Device options
# @param params HTTP GET parameters (without ?)
def eps_run_command(options, params):
- # String for Authorization header
- auth_str = 'Basic ' + string.strip(base64.encodestring(options["-l"]+':'+options["-p"]))
try:
# New http connection
conn = httplib.HTTPConnection(options["-a"])
@@ -37,8 +35,14 @@ def eps_run_command(options, params):
eps_log(options,"GET "+request_str+"\n")
conn.putrequest('GET', request_str)
- eps_log(options,"Authorization:"+auth_str+"\n")
- conn.putheader('Authorization',auth_str)
+ if (options.has_key("-l")):
+ if (not options.has_key("-p")):
+ options["-p"]="" # Default is empty password
+
+ # String for Authorization header
+ auth_str = 'Basic ' + string.strip(base64.encodestring(options["-l"]+':'+options["-p"]))
+ eps_log(options,"Authorization:"+auth_str+"\n")
+ conn.putheader('Authorization',auth_str)
conn.endheaders()
@@ -88,18 +92,11 @@ def eps_define_new_opts():
def main():
device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug",
"action", "ipaddr", "login", "passwd", "passwd_script",
- "test", "port", "hidden_page", "no_login" ]
+ "test", "port", "hidden_page", "no_login", "no_password" ]
eps_define_new_opts()
- # Because we DON'T need password, we must do little hack
- input_opts=process_input(device_opt)
- if ((not input_opts.has_key("-p")) and (not input_opts.has_key("-S"))):
- input_opts["-p"]=""
- if (not input_opts.has_key("-l")):
- input_opts["-l"]=""
-
- options = check_input(device_opt,input_opts)
+ options = check_input(device_opt,process_input(device_opt))
if (not options.has_key("-c")):
options["-c"]="hidden.htm"
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 3398aa9..40fe29f 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -70,6 +70,10 @@ all_opt = {
"getopt" : "",
"help" : "",
"order" : 1 },
+ "no_password" : {
+ "getopt" : "",
+ "help" : "",
+ "order" : 1 },
"passwd" : {
"getopt" : "p:",
"help" : "-p <password> Login password or passphrase",
@@ -296,12 +300,13 @@ def check_input(device_opt, opt):
if 0 == options.has_key("-a"):
fail_usage("Failed: You have to enter fence address")
- 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 (device_opt.count("no_password") == 0):
+ 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)")
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-10-22 14:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-22 14:21 master - fence: Added support for no_password in fence agents library and fence_eps 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).