fence-agents: master - fencing: default values for ipport #2 (--ssl-insecure, SNMP agents)

Marek GrĂ¡c marx at fedoraproject.org
Wed Jan 14 16:57:53 UTC 2015


Gitweb:        http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=aedf4507290a2d2a504a251f99f60ab38225166d
Commit:        aedf4507290a2d2a504a251f99f60ab38225166d
Parent:        4cbbc342c518b6e09b792b63026f4af0aa7e9ee3
Author:        Marek 'marx' Grac <mgrac at redhat.com>
AuthorDate:    Wed Jan 14 17:55:25 2015 +0100
Committer:     Marek 'marx' Grac <mgrac at redhat.com>
CommitterDate: Wed Jan 14 17:55:25 2015 +0100

fencing: default values for ipport #2 (--ssl-insecure, SNMP agents)

Previous patch of this problem:
	* did not solve problem was --ssl-insecure
	* did not work correctly with minimalist SNMP agent where snmp_version can not be set

Problem found using unit-tests.
---
 fence/agents/lib/fencing.py.py |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index c0ff034..adf9e6f 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -1091,9 +1091,9 @@ def _update_metadata(options):
 			default_value = "23"
 			default_string = "(default 23, 22 if --ssh option is used)"
 		else:
-			tcp_ports = {"snmp_version" : "161", "secure" : "22", "telnet" : "23", "web" : "80", "ssl" : "443"}
+			tcp_ports = {"community" : "161", "secure" : "22", "telnet" : "23", "web" : "80", "ssl" : "443"}
 			# all cases where next command returns multiple results are covered by previous blocks
-			protocol = [x for x in ["snmp_version", "secure", "ssl", "web", "telnet"] if device_opt.count(x)][0]
+			protocol = [x for x in ["community", "secure", "ssl", "web", "telnet"] if device_opt.count(x)][0]
 			default_value = tcp_ports[protocol]
 
 		if default_string is None:
@@ -1107,7 +1107,7 @@ def _set_default_values(options):
 		if not "--ipport" in options:
 			if "default" in all_opt["ipport"]:
 				options["--ipport"] = all_opt["ipport"]["default"]
-			elif "snmp_version" in options["device_opt"]:
+			elif "community" in options["device_opt"]:
 				options["--ipport"] = "161"
 			elif "--ssh" in options or all_opt["secure"].get("default", "0") == "1":
 				options["--ipport"] = "22"
@@ -1115,6 +1115,8 @@ def _set_default_values(options):
 				options["--ipport"] = "443"
 			elif "--ssl-secure" in options or all_opt["ssl_secure"].get("default", "0") == "1":
 				options["--ipport"] = "443"
+			elif "--ssl-insecure" in options or all_opt["ssl_insecure"].get("default", "0") == "1":
+				options["--ipport"] = "443"
 			elif "web" in options["device_opt"]:
 				options["--ipport"] = "80"
 			elif "telnet" in options["device_opt"]:


More information about the cluster-commits mailing list