fence-agents: Use default values for device options instead of per-agent solutions
PATCH 3/3 fence-agents: Use default values for device options instead of per-agent solutions
Majority of these changes concern:
* (-x / ssh) to be turn on by default
* command prompt default which differs across fence agents
--- fence/agents/alom/fence_alom.py | 10 +++------- fence/agents/apc/fence_apc.py | 9 ++------- fence/agents/drac5/fence_drac5.py | 8 ++------ fence/agents/eaton_snmp/fence_eaton_snmp.py | 8 ++------ fence/agents/ibmblade/fence_ibmblade.py | 6 +----- fence/agents/ifmib/fence_ifmib.py | 5 +---- fence/agents/ilo/fence_ilo.py | 7 ++----- fence/agents/ipdu/fence_ipdu.py | 14 +++++--------- fence/agents/ldom/fence_ldom.py | 13 +++---------- fence/agents/lpar/fence_lpar.py | 7 +------ fence/agents/rsa/fence_rsa.py | 8 ++------ fence/agents/rsb/fence_rsb.py | 2 -- fence/agents/sanbox2/fence_sanbox2.py | 8 ++------ fence/agents/virsh/fence_virsh.py | 9 +++------ fence/agents/vmware/fence_vmware.py | 10 ++-------- fence/agents/wti/fence_wti.py | 8 ++------ fence/agents/xenapi/fence_xenapi.py | 4 +--- 17 files changed, 34 insertions(+), 102 deletions(-)
fence/agents/alom/fence_alom.py +3 -7
@@ -47,15 +47,11 @@ def main(): "identity_file", "test", "inet4_only", "inet6_only", "ipport" ] atexit.register(atexit_handler) - - pinput = process_input(device_opt) - pinput["-x"] = 1 - options = check_input(device_opt, pinput) - # Default command is sc> - if (not options.has_key("-c")): - options["-c"] = "sc\>\ " + all_opt["secure"]["default"] = "1" + all_opt["cmd_prompt"]["default"] = [ "sc\>\ " ] + options = check_input(device_opt, process_input(device_opt)) options["telnet_over_ssh"] = 1 docs = { }
fence/agents/apc/fence_apc.py +2 -7
@@ -188,16 +188,11 @@ def main(): atexit.register(atexit_handler) - options = check_input(device_opt, process_input(device_opt)) + all_opt["cmd_prompt"]["default"] = [ "\n>" ] - ## - ## Fence agent specific defaults - ##### + options = check_input(device_opt, process_input(device_opt)) options["ssh_options"] = "-1 -c blowfish" - if 0 == options.has_key("-c"): - options["-c"] = "\n>" - docs = { } docs["shortdesc"] = "Fence agent for APC over telnet/ssh" docs["longdesc"] = "fence_apc is an I/O Fencing agent \
fence/agents/drac5/fence_drac5.py +2 -6
@@ -91,13 +91,9 @@ def main(): atexit.register(atexit_handler) - options = check_input(device_opt, process_input(device_opt)) + all_opt["cmd_prompt"]["default"] = [ "\$" ] - ## - ## Fence agent specific defaults - ##### - if 0 == options.has_key("-c"): - options["-c"] = "\$" + options = check_input(device_opt, process_input(device_opt)) docs = { } docs["shortdesc"] = "Fence agent for Dell DRAC CMC/5"
fence/agents/eaton_snmp/fence_eaton_snmp.py +2 -6
@@ -197,11 +197,6 @@ def get_outlets_status(conn, options): return result -# Define new options -def eaton_snmp_define_defaults(): - all_opt["snmp_version"]["default"]="1" - all_opt["community"]["default"]="private" - # Main agent method def main(): device_opt = [ "ipaddr", "login", "passwd", "passwd_script",
@@ -213,10 +208,11 @@ def main(): atexit.register(atexit_handler) snmp_define_defaults () - eaton_snmp_define_defaults() all_opt["switch"]["default"] = 1 all_opt["power_wait"]["default"] = 2 + all_opt["snmp_version"]["default"] = "1" + all_opt["community"]["default"] = "private" options=check_input(device_opt,process_input(device_opt)) # Plug indexing start from zero on ePDU Managed, so we substract '1' from
fence/agents/ibmblade/fence_ibmblade.py +1 -5
@@ -48,10 +48,6 @@ def get_outlets_status(conn, options): return result -# Define new options -def ibmblade_define_defaults(): - all_opt["snmp_version"]["default"]="1" - # Main agent method def main(): global port_oid
@@ -65,7 +61,7 @@ def main(): atexit.register(atexit_handler) snmp_define_defaults () - ibmblade_define_defaults() + all_opt["snmp_version"]["default"]="1" options=check_input(device_opt,process_input(device_opt))
fence/agents/ifmib/fence_ifmib.py +1 -4
@@ -93,10 +93,6 @@ def get_outlets_status(conn, options): return result -# Define new options -def ifmib_define_defaults(): - all_opt["snmp_version"]["default"]="2c" - # Main agent method def main(): global port_oid
@@ -110,6 +106,7 @@ def main(): atexit.register(atexit_handler) snmp_define_defaults () + all_opt["snmp_version"]["default"]="2c" options=process_input(device_opt)
fence/agents/ilo/fence_ilo.py +2 -5
@@ -65,12 +65,9 @@ def main(): all_opt["login_timeout"]["default"] = "10" all_opt["retry_on"]["default"] = "3" + all_opt["ssl"]["default"] = "1" - pinput = process_input(device_opt) - pinput["-z"] = 1 - options = check_input(device_opt, pinput) - - LOGIN_TIMEOUT = 10 + options = check_input(device_opt, process_input(device_opt)) docs = { } docs["shortdesc"] = "Fence agent for HP iLO"
fence/agents/ipdu/fence_ipdu.py +5 -9
@@ -129,13 +129,6 @@ def get_outlets_status(conn, options): return result -# Define new options -def ipdu_snmp_define_defaults(): - all_opt["snmp_version"]["default"]="3" - all_opt["community"]["default"]="private" - all_opt["switch"]["default"]="1" - device=IBMiPDU - # Main agent method def main(): device_opt = [ "ipaddr", "login", "passwd", "passwd_script",
@@ -147,9 +140,12 @@ def main(): atexit.register(atexit_handler) snmp_define_defaults () - ipdu_snmp_define_defaults() + all_opt["snmp_version"]["default"] = "3" + all_opt["community"]["default"] = "private" + all_opt["switch"]["default"] = "1" + device = IBMiPDU - options=check_input(device_opt,process_input(device_opt)) + options = check_input(device_opt,process_input(device_opt)) docs = { } docs["shortdesc"] = "Fence agent for iPDU over SNMP"
fence/agents/ldom/fence_ldom.py +3 -10
@@ -87,16 +87,9 @@ def main(): atexit.register(atexit_handler) - pinput = process_input(device_opt) - pinput["-x"] = 1 - options = check_input(device_opt, pinput) - - ## - ## Fence agent specific defaults - ##### - if (not options.has_key("-c")): - options["-c"] = "\ $" - + all_opt["secure"]["default"] = "1" + all_opt["cmd_prompt"]["default"] = [ "\ $" ] + docs = { } docs["shortdesc"] = "Fence agent for Sun LDOM" docs["longdesc"] = "fence_ldom is an I/O Fencing agent \
fence/agents/lpar/fence_lpar.py +1 -6
@@ -138,15 +138,10 @@ def main(): all_opt["login_timeout"]["default"] = "15" all_opt["secure"]["default"] = "1" + all_opt["cmd_prompt"]["default"] = [ ":~>", "]\$", "\$ " ] options = check_input(device_opt, process_input(device_opt)) - ## - ## Fence agent specific settings and default values - ##### - if 0 == options.has_key("-c"): - options["-c"] = [ ":~>", "]\$", "\$ " ] - docs = { } docs["shortdesc"] = "Fence agent for IBM LPAR" docs["longdesc"] = ""
fence/agents/rsa/fence_rsa.py +2 -6
@@ -50,14 +50,10 @@ def main(): atexit.register(atexit_handler) all_opt["login_timeout"]["default"] = 10 + all_opt["cmd_prompt"]["default"] = [ ">" ] + options = check_input(device_opt, process_input(device_opt)) - ## - ## Fence agent specific defaults - ##### - if 0 == options.has_key("-c"): - options["-c"] = ">" - # This device will not allow us to login even with LANG=C options["ssh_options"] = "-F /dev/null"
fence/agents/rsb/fence_rsb.py +0 -2
@@ -85,8 +85,6 @@ will block any necessary fencing actions." ## ## Operate the fencing device #### - print options["-u"] - conn = fence_login(options) result = fence_action(conn, options, set_power_status, get_power_status, None)
fence/agents/sanbox2/fence_sanbox2.py +2 -6
@@ -113,13 +113,9 @@ def main(): atexit.register(atexit_handler) - options = check_input(device_opt, process_input(device_opt)) + all_opt["cmd_prompt"]["default"] = [ " #> " ] - ## - ## Fence agent specific defaults - ##### - if 0 == options.has_key("-c"): - options["-c"] = [ " #> " ] + options = check_input(device_opt, process_input(device_opt)) docs = { } docs["shortdesc"] = "Fence agent for QLogic SANBox2 FC switches"
fence/agents/virsh/fence_virsh.py +3 -6
@@ -77,13 +77,10 @@ def main(): atexit.register(atexit_handler) - pinput = process_input(device_opt) - pinput["-x"] = 1 - options = check_input(device_opt, pinput) + all_opt["secure"]["default"] = "1" + all_opt["cmd_prompt"]["default"] = [ "\[EXPECT\]#\ " ] - ## Defaults for fence agent - if 0 == options.has_key("-c"): - options["-c"] = "\[EXPECT\]#\ " + options = check_input(device_opt, process_input(device_opt)) options["ssh_options"]="-t '/bin/bash -c \"PS1=\[EXPECT\]#\ /bin/bash --noprofile --norc\"'"
fence/agents/vmware/fence_vmware.py +2 -8
@@ -256,10 +256,6 @@ def vmware_is_supported_vmrun_version(options): return True -# Define new options -def vmware_define_defaults(): - all_opt["vmware_type"]["default"]=VMWARE_DEFAULT_TYPE - # Check vmware type, set vmware_internal_type to one of VMWARE_TYPE_ value and # options["-e"] to path (if not specified) def vmware_check_vmware_type(options):
@@ -290,13 +286,11 @@ def main(): atexit.register(atexit_handler) - vmware_define_defaults() + all_opt["secure"]["default"] = "1" + all_opt["vmware_type"]["default"] = VMWARE_DEFAULT_TYPE options = check_input(device_opt, process_input(device_opt)) - # Default is secure connection - options["-x"] = 1 - docs = { } docs["shortdesc"] = "Fence agent for VMWare" docs["longdesc"] = "fence_vmware is an I/O Fencing agent \
fence/agents/wti/fence_wti.py +2 -6
@@ -96,13 +96,9 @@ def main(): atexit.register(atexit_handler) - options = check_input(device_opt, process_input(device_opt)) + all_opt["cmd_prompt"]["default"] = [ "RSM>", "MPC>", "IPS>", "TPS>", "NBB>", "NPS>", "VMR>" ] - ## - ## Fence agent specific defaults - ##### - if 0 == options.has_key("-c"): - options["-c"] = [ "RSM>", "MPC>", "IPS>", "TPS>", "NBB>", "NPS>", "VMR>" ] + options = check_input(device_opt, process_input(device_opt)) docs = { } docs["shortdesc"] = "Fence agent for WTI"
fence/agents/xenapi/fence_xenapi.py +1 -3
@@ -204,9 +204,7 @@ def main(): atexit.register(atexit_handler) - options=process_input(device_opt) - - options = check_input(device_opt, options) + options = check_input(device_opt, process_input(device_opt)) docs = { } docs["shortdesc"] = "XenAPI based fencing for the Citrix XenServer virtual machines."
Signature · 1 line
1.7.7.6