Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=90ce5ac64... Commit: 90ce5ac64762f54eada6cc6f4623a98e2eb493f7 Parent: 6687842cd2bd608555efd2bc624c68c0250c6ef4 Author: Marek 'marx' Grac mgrac@redhat.com AuthorDate: Wed Apr 16 14:54:05 2014 +0200 Committer: Marek 'marx' Grac mgrac@redhat.com CommitterDate: Wed Apr 16 14:54:05 2014 +0200
fencing: ipport defaults was set after defaults were used
SNMP fence agents were influenced - introduced in 91dcb051959c5e70094cbb3c5b5243e4a328d8bc --- fence/agents/lib/fencing.py.py | 24 +++++++++++++----------- 1 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py index 56a8a1a..c84476f 100644 --- a/fence/agents/lib/fencing.py.py +++ b/fence/agents/lib/fencing.py.py @@ -636,25 +636,20 @@ def check_input(device_opt, opt): all_opt["action"]["default"] = "off" all_opt["action"]["help"] = "-o, --action=[action] Action: status, off (default) or on"
- ## Set default values - ##### - for opt in device_opt: - if all_opt[opt].has_key("default"): - getopt_long = "--" + all_opt[opt]["longopt"] - if 0 == options.has_key(getopt_long): - options[getopt_long] = all_opt[opt]["default"] - if device_opt.count("ipport"): if options.has_key("--ipport"): all_opt["ipport"]["help"] = "-u, --ipport=[port] " + \ "TCP/UDP port to use (default " + options["--ipport"] +")" + elif all_opt.has_key("ipport") and all_opt["ipport"].has_key("default"): + all_opt["ipport"]["help"] = "-u, --ipport=[port] " + \ + "TCP/UDP port to use (default " + all_opt["ipport"]["default"] +")" elif device_opt.count("snmp_version"): all_opt["ipport"]["default"] = "161" all_opt["ipport"]["help"] = "-u, --ipport=[port] TCP/UDP port to use (default 161)" - elif options.has_key("--ssh"): + elif options.has_key("--ssh") or (all_opt["secure"].has_key("default") and all_opt["secure"]["default"] == '1'): all_opt["ipport"]["default"] = 22 all_opt["ipport"]["help"] = "-u, --ipport=[port] TCP/UDP port to use (default 22)" - elif options.has_key("--ssl"): + elif options.has_key("--ssl") or (all_opt["ssl"].has_key("default") and all_opt["ssl"]["default"] == '1'): all_opt["ipport"]["default"] = 443 all_opt["ipport"]["help"] = "-u, --ipport=[port] TCP/UDP port to use (default 443)" elif device_opt.count("web"): @@ -670,8 +665,15 @@ def check_input(device_opt, opt): all_opt["ipport"]["help"] = "-u, --ipport=[port] TCP/UDP port to use (default 23)" else: all_opt["ipport"]["help"] = "-u, --ipport=[port] TCP/UDP port to use\n\ - (default 23, 22 if --ssh option is used)" + (default 23, 22 if --ssh option is used)"
+ ## Set default values + ##### + for opt in device_opt: + if all_opt[opt].has_key("default"): + getopt_long = "--" + all_opt[opt]["longopt"] + if 0 == options.has_key(getopt_long): + options[getopt_long] = all_opt[opt]["default"]
## In special cases (show help, metadata or version) we don't need to check anything #####
cluster-commits@lists.fedorahosted.org