public inbox for cluster-cvs@sourceware.org help / color / mirror / Atom feed
From: "Marek Grác" <marx@fedoraproject.org> To: cluster-cvs-relay@redhat.com Subject: cluster: STABLE3 - fencing: Create a function that prints documentation Date: Mon, 13 Jul 2009 14:53:00 -0000 [thread overview] Message-ID: <20090713145302.B82AF1201FF@lists.fedorahosted.org> (raw) Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=014fead2ca7adce6b3832a0585498f4abcc3250e Commit: 014fead2ca7adce6b3832a0585498f4abcc3250e Parent: 05488044454ca7737f52f2d846b54b87ae08813b Author: Marek 'marx' Grac <mgrac@redhat.com> AuthorDate: Mon Jul 13 16:44:38 2009 +0200 Committer: Marek 'marx' Grac <mgrac@redhat.com> CommitterDate: Mon Jul 13 16:44:38 2009 +0200 fencing: Create a function that prints documentation This have to be moved because we need access also to agent specific values as they will be presented as defaults in metadata. Prerequisite for man pages generation. 1st part of solution for bz#488959 --- fence/agents/alom/fence_alom.py | 4 ++- fence/agents/apc/fence_apc.py | 2 + fence/agents/apc_snmp/fence_apc_snmp.py | 2 + fence/agents/bladecenter/fence_bladecenter.py | 2 + fence/agents/cisco_mds/fence_cisco_mds.py | 2 + fence/agents/drac/fence_drac5.py | 2 + fence/agents/eps/fence_eps.py | 2 + fence/agents/ibmblade/fence_ibmblade.py | 2 + fence/agents/ifmib/fence_ifmib.py | 2 + fence/agents/ilo/fence_ilo.py | 2 + fence/agents/intelmodular/fence_intelmodular.py | 2 + fence/agents/ldom/fence_ldom.py | 2 + fence/agents/lib/fencing.py.py | 36 ++++++++++++++-------- fence/agents/lpar/fence_lpar.py | 4 ++- fence/agents/rsa/fence_rsa.py | 2 + fence/agents/virsh/fence_virsh.py | 2 + fence/agents/vmware/fence_vmware.py | 2 + fence/agents/wti/fence_wti.py | 2 + 18 files changed, 59 insertions(+), 15 deletions(-) diff --git a/fence/agents/alom/fence_alom.py b/fence/agents/alom/fence_alom.py index 610ec2b..5fe72aa 100644 --- a/fence/agents/alom/fence_alom.py +++ b/fence/agents/alom/fence_alom.py @@ -53,11 +53,13 @@ def main(): # Default command is sc> if (not options.has_key("-c")): - options["-c"] = "sc\>\ " + options["-c"] = "sc\>\ " # Default to ssh options["-x"] = 1 options["telnet_over_ssh"] = 1 + + show_docs(options) # Operate the fencing device conn = fence_login(options) diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py index 13bad67..e4a3e3d 100755 --- a/fence/agents/apc/fence_apc.py +++ b/fence/agents/apc/fence_apc.py @@ -199,6 +199,8 @@ def main(): if 0 == options.has_key("-c"): options["-c"] = "\n>" + show_docs(options) + ## Support for -n [switch]:[plug] notation that was used before if (options.has_key("-n") == 1) and (-1 != options["-n"].find(":")): (switch, plug) = options["-n"].split(":", 1) diff --git a/fence/agents/apc_snmp/fence_apc_snmp.py b/fence/agents/apc_snmp/fence_apc_snmp.py index 6ff1318..91331b5 100644 --- a/fence/agents/apc_snmp/fence_apc_snmp.py +++ b/fence/agents/apc_snmp/fence_apc_snmp.py @@ -187,6 +187,8 @@ def main(): if (not (options.has_key("-s"))): options["-s"]="1" + show_docs(options) + # Operate the fencing device fence_action(FencingSnmp(options), options, set_power_status, get_power_status, get_outlets_status) diff --git a/fence/agents/bladecenter/fence_bladecenter.py b/fence/agents/bladecenter/fence_bladecenter.py index d694966..5df4869 100644 --- a/fence/agents/bladecenter/fence_bladecenter.py +++ b/fence/agents/bladecenter/fence_bladecenter.py @@ -103,6 +103,8 @@ def main(): if 0 == options.has_key("-c"): options["-c"] = "system>" + show_docs(options) + ## ## Operate the fencing device ###### diff --git a/fence/agents/cisco_mds/fence_cisco_mds.py b/fence/agents/cisco_mds/fence_cisco_mds.py index 0d57c04..67948e6 100644 --- a/fence/agents/cisco_mds/fence_cisco_mds.py +++ b/fence/agents/cisco_mds/fence_cisco_mds.py @@ -105,6 +105,8 @@ def main(): options = check_input(device_opt, options) + show_docs(options) + if (not (options["-o"] in ["list","monitor"])): port_oid=cisco_port2oid(options["-n"]) diff --git a/fence/agents/drac/fence_drac5.py b/fence/agents/drac/fence_drac5.py index af4a1ed..b669bac 100755 --- a/fence/agents/drac/fence_drac5.py +++ b/fence/agents/drac/fence_drac5.py @@ -96,6 +96,8 @@ def main(): if 0 == options.has_key("-c"): options["-c"] = "\$" + show_docs(options) + ## ## Operate the fencing device ###### diff --git a/fence/agents/eps/fence_eps.py b/fence/agents/eps/fence_eps.py index f751d29..604a481 100644 --- a/fence/agents/eps/fence_eps.py +++ b/fence/agents/eps/fence_eps.py @@ -107,6 +107,8 @@ def main(): if (not options.has_key("-c")): options["-c"]="hidden.htm" + show_docs(options) + #Run fence action. Conn is None, beacause we always need open new http connection fence_action(None, options, set_power_status, get_power_status,get_power_status) diff --git a/fence/agents/ibmblade/fence_ibmblade.py b/fence/agents/ibmblade/fence_ibmblade.py index e6d0dac..7532221 100644 --- a/fence/agents/ibmblade/fence_ibmblade.py +++ b/fence/agents/ibmblade/fence_ibmblade.py @@ -69,6 +69,8 @@ def main(): options=check_input(device_opt,process_input(device_opt)) + show_docs(options) + # Operate the fencing device fence_action(FencingSnmp(options), options, set_power_status, get_power_status, get_outlets_status) diff --git a/fence/agents/ifmib/fence_ifmib.py b/fence/agents/ifmib/fence_ifmib.py index 7473129..a6c452d 100644 --- a/fence/agents/ifmib/fence_ifmib.py +++ b/fence/agents/ifmib/fence_ifmib.py @@ -125,6 +125,8 @@ def main(): options = check_input(device_opt, options) + show_docs(options) + # Operate the fencing device fence_action(FencingSnmp(options), options, set_power_status, get_power_status, get_outlets_status) diff --git a/fence/agents/ilo/fence_ilo.py b/fence/agents/ilo/fence_ilo.py index c2fd70b..e15052d 100755 --- a/fence/agents/ilo/fence_ilo.py +++ b/fence/agents/ilo/fence_ilo.py @@ -65,6 +65,8 @@ def main(): options["-z"] = 1 LOGIN_TIMEOUT = 10 + show_docs(options) + ## ## Login and get version number #### diff --git a/fence/agents/intelmodular/fence_intelmodular.py b/fence/agents/intelmodular/fence_intelmodular.py index 6b68d0b..492bbc5 100644 --- a/fence/agents/intelmodular/fence_intelmodular.py +++ b/fence/agents/intelmodular/fence_intelmodular.py @@ -74,6 +74,8 @@ def main(): options=check_input(device_opt,process_input(device_opt)) + show_docs(options) + # Operate the fencing device fence_action(FencingSnmp(options), options, set_power_status, get_power_status, get_outlets_status) diff --git a/fence/agents/ldom/fence_ldom.py b/fence/agents/ldom/fence_ldom.py index 021f036..e6bf656 100644 --- a/fence/agents/ldom/fence_ldom.py +++ b/fence/agents/ldom/fence_ldom.py @@ -98,6 +98,8 @@ def main(): options["-x"] = 1 + show_docs(options) + ## ## Operate the fencing device #### diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py index feb01f8..3829ccc 100644 --- a/fence/agents/lib/fencing.py.py +++ b/fence/agents/lib/fencing.py.py @@ -481,20 +481,10 @@ def check_input(device_opt, opt): else: all_opt["login"]["required"] = "0" - ## Process special options (and exit) + ## In special cases (show help, metadata or version) we don't need to check anything ##### - if options.has_key("-h"): - usage(device_opt) - sys.exit(0) - - if options.has_key("-o") and options["-o"].lower() == "metadata": - metadata(device_opt) - sys.exit(0) - - if options.has_key("-V"): - print RELEASE_VERSION, BUILD_DATE - print REDHAT_COPYRIGHT - sys.exit(0) + if options.has_key("-h") or options.has_key("-V") or (options.has_key("-o") and options["-o"].lower() == "metadata"): + return options; ## Set default values ##### @@ -571,7 +561,27 @@ def wait_power_status(tn, options, get_power_fn): return 1 return 0 +def show_docs(options): + device_opt = options["device_opt"] + + ## Process special options (and exit) + ##### + if options.has_key("-h"): + usage(device_opt) + sys.exit(0) + + if options.has_key("-o") and options["-o"].lower() == "metadata": + metadata(device_opt) + sys.exit(0) + + if options.has_key("-V"): + print RELEASE_VERSION, BUILD_DATE + print REDHAT_COPYRIGHT + sys.exit(0) + def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None): + ## Process options that manipulate fencing device + ##### if (options["-o"] == "list") and (0 == options["device_opt"].count("port")) and (0 == options["device_opt"].count("partition")): print "N/A" return diff --git a/fence/agents/lpar/fence_lpar.py b/fence/agents/lpar/fence_lpar.py index cb74f1d..f6e4a58 100644 --- a/fence/agents/lpar/fence_lpar.py +++ b/fence/agents/lpar/fence_lpar.py @@ -140,13 +140,15 @@ def main(): options = check_input(device_opt, process_input(device_opt)) ## - ## Fence agent specific defaults + ## Fence agent specific settings and default values ##### if 0 == options.has_key("-c"): options["-c"] = [ ":~>", "]\$", "\$ " ] if 0 == options.has_key("-x"): fail_usage("Failed: You have to use ssh connection (-x) to fence device") + + show_docs(options) if 0 == options.has_key("-s"): fail_usage("Failed: You have to enter name of managed system") diff --git a/fence/agents/rsa/fence_rsa.py b/fence/agents/rsa/fence_rsa.py index dd2f579..9c33327 100644 --- a/fence/agents/rsa/fence_rsa.py +++ b/fence/agents/rsa/fence_rsa.py @@ -55,6 +55,8 @@ def main(): # This device will not allow us to login even with LANG=C options["ssh_options"] = "-F /dev/null" + + show_docs(options) ## ## Operate the fencing device diff --git a/fence/agents/virsh/fence_virsh.py b/fence/agents/virsh/fence_virsh.py index 6866fb0..038e903 100644 --- a/fence/agents/virsh/fence_virsh.py +++ b/fence/agents/virsh/fence_virsh.py @@ -77,6 +77,8 @@ def main(): options["ssh_options"]="-t '/bin/bash -c \"PS1=\[EXPECT\]#\ /bin/bash --noprofile --norc\"'" + show_docs(options) + ## Operate the fencing device conn = fence_login(options) fence_action(conn, options, set_power_status, get_power_status, get_outlets_status) diff --git a/fence/agents/vmware/fence_vmware.py b/fence/agents/vmware/fence_vmware.py index 42dc097..10307c1 100644 --- a/fence/agents/vmware/fence_vmware.py +++ b/fence/agents/vmware/fence_vmware.py @@ -290,6 +290,8 @@ def main(): # Default is secure connection options["-x"] = 1 + show_docs(options) + # Check vmware type and set path vmware_check_vmware_type(options) diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py index 35b4d54..13c6b52 100644 --- a/fence/agents/wti/fence_wti.py +++ b/fence/agents/wti/fence_wti.py @@ -88,6 +88,8 @@ def main(): if 0 == options.has_key("-c"): options["-c"] = [ "RSM>", "MPC>", "IPS>", "TPS>", "NBB>", "NPS>" ] + show_docs(options) + ## ## Operate the fencing device ##
reply other threads:[~2009-07-13 14:53 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20090713145302.B82AF1201FF@lists.fedorahosted.org \ --to=marx@fedoraproject.org \ --cc=cluster-cvs-relay@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).