fence-agents: master - fencing: default value for ipport was not always correct
Marek GrĂ¡c
marx at fedoraproject.org
Wed Jan 14 14:59:08 UTC 2015
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=575cbe08a6077ecc1512ceaecfc964378c1a11a6
Commit: 575cbe08a6077ecc1512ceaecfc964378c1a11a6
Parent: 6b37cab7bc7fe41ce313d947b9c409c994c23451
Author: Marek 'marx' Grac <mgrac at redhat.com>
AuthorDate: Wed Jan 14 15:56:15 2015 +0100
Committer: Marek 'marx' Grac <mgrac at redhat.com>
CommitterDate: Wed Jan 14 15:56:15 2015 +0100
fencing: default value for ipport was not always correct
Correction of metadata output lead to situation when default value of
ipport was not properly set e.g. if --ssh was not default, it's value
was ignored. This update, moves setting default value to proper function.
---
fence/agents/lib/fencing.py.py | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index b9a2028..c0ff034 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -1096,7 +1096,6 @@ def _update_metadata(options):
protocol = [x for x in ["snmp_version", "secure", "ssl", "web", "telnet"] if device_opt.count(x)][0]
default_value = tcp_ports[protocol]
- all_opt["ipport"]["default"] = default_value
if default_string is None:
all_opt["ipport"]["help"] = "-u, --ipport=[port] TCP/UDP port to use (default %s)" % \
(default_value)
@@ -1104,8 +1103,25 @@ def _update_metadata(options):
all_opt["ipport"]["help"] = "-u, --ipport=[port] TCP/UDP port to use\n" + " "*40 + default_string
def _set_default_values(options):
+ if "ipport" in options["device_opt"]:
+ if not "--ipport" in options:
+ if "default" in all_opt["ipport"]:
+ options["--ipport"] = all_opt["ipport"]["default"]
+ elif "snmp_version" in options["device_opt"]:
+ options["--ipport"] = "161"
+ elif "--ssh" in options or all_opt["secure"].get("default", "0") == "1":
+ options["--ipport"] = "22"
+ elif "--ssl" in options or all_opt["ssl"].get("default", "0") == "1":
+ options["--ipport"] = "443"
+ elif "--ssl-secure" in options or all_opt["ssl_secure"].get("default", "0") == "1":
+ options["--ipport"] = "443"
+ elif "web" in options["device_opt"]:
+ options["--ipport"] = "80"
+ elif "telnet" in options["device_opt"]:
+ options["--ipport"] = "23"
+
for opt in options["device_opt"]:
- if all_opt[opt].has_key("default"):
+ if all_opt[opt].has_key("default") and not opt == "ipport":
getopt_long = "--" + all_opt[opt]["longopt"]
if not options.has_key(getopt_long):
options[getopt_long] = all_opt[opt]["default"]
More information about the cluster-commits
mailing list