fence-agents: master - fence_cisco_ucs: Incorrect timeout was used during login

Marek GrĂ¡c marx at fedoraproject.org
Mon Oct 29 11:27:54 UTC 2012


Gitweb:        http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=9851b2aec92f30456fb88a1c69ca964fae58e1ec
Commit:        9851b2aec92f30456fb88a1c69ca964fae58e1ec
Parent:        62004c338202dfadfa4b8f2cefd959867c9afa74
Author:        Marek 'marx' Grac <mgrac at redhat.com>
AuthorDate:    Mon Oct 22 15:51:55 2012 +0200
Committer:     Marek 'marx' Grac <mgrac at redhat.com>
CommitterDate: Mon Oct 29 12:23:57 2012 +0100

fence_cisco_ucs: Incorrect timeout was used during login

Previously, login command was bound with shell_timeout instead of login_timeout.
---
 fence/agents/cisco_ucs/fence_cisco_ucs.py |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/fence/agents/cisco_ucs/fence_cisco_ucs.py b/fence/agents/cisco_ucs/fence_cisco_ucs.py
index 8020d96..84cb4fd 100644
--- a/fence/agents/cisco_ucs/fence_cisco_ucs.py
+++ b/fence/agents/cisco_ucs/fence_cisco_ucs.py
@@ -18,7 +18,7 @@ re_get_desc = re.compile(" descr=\"(.*?)\"", re.IGNORECASE)
 
 def get_power_status(conn, options):
 	try:
-		res = send_command(options, "<configResolveDn cookie=\"" + options["cookie"] + "\" inHierarchical=\"false\" dn=\"org-root" + options["-s"] + "/ls-" + options["-n"] + "/power\"/>")
+		res = send_command(options, "<configResolveDn cookie=\"" + options["cookie"] + "\" inHierarchical=\"false\" dn=\"org-root" + options["-s"] + "/ls-" + options["-n"] + "/power\"/>", int(options["-Y"]))
 	except pycurl.error, e:
 		sys.stderr.write(e[1] + "\n")
 		fail(EC_TIMED_OUT)
@@ -41,7 +41,7 @@ def set_power_status(conn, options):
 	}[options["-o"]]
 	
 	try:
-		res = send_command(options, "<configConfMos cookie=\"" + options["cookie"] + "\" inHierarchical=\"no\"><inConfigs><pair key=\"org-root" + options["-s"] + "/ls-" + options["-n"] + "/power\"><lsPower dn=\"org-root/ls-" + options["-n"] + "/power\" state=\"" + action + "\" status=\"modified\" /></pair></inConfigs></configConfMos>")
+		res = send_command(options, "<configConfMos cookie=\"" + options["cookie"] + "\" inHierarchical=\"no\"><inConfigs><pair key=\"org-root" + options["-s"] + "/ls-" + options["-n"] + "/power\"><lsPower dn=\"org-root/ls-" + options["-n"] + "/power\" state=\"" + action + "\" status=\"modified\" /></pair></inConfigs></configConfMos>", int(options["-Y"]))
 	except pycurl.error, e:
 		sys.stderr.write(e[1] + "\n")
 		fail(EC_TIMED_OUT)
@@ -53,7 +53,7 @@ def get_list(conn, options):
 
 	try:
 		try:
-			res = send_command(options, "<configResolveClass cookie=\"" + options["cookie"] + "\" inHierarchical=\"false\" classId=\"lsServer\"/>")
+			res = send_command(options, "<configResolveClass cookie=\"" + options["cookie"] + "\" inHierarchical=\"false\" classId=\"lsServer\"/>", int(options["-Y"]))
 		except pycurl.error, e:
 			sys.stderr.write(e[1] + "\n")
 			fail(EC_TIMED_OUT)
@@ -70,7 +70,7 @@ def get_list(conn, options):
 
 	return outlets
 
-def send_command(opt, command):
+def send_command(opt, command, timeout):
 	## setup correct URL
 	if opt.has_key("-z"):
 		url = "https:"
@@ -86,7 +86,7 @@ def send_command(opt, command):
 	c.setopt(pycurl.HTTPHEADER, [ "Content-type: text/xml" ])
 	c.setopt(pycurl.POSTFIELDS, command)
 	c.setopt(pycurl.WRITEFUNCTION, b.write)
-	c.setopt(pycurl.TIMEOUT, int(opt["-Y"]))
+	c.setopt(pycurl.TIMEOUT, timeout)
 	c.setopt(pycurl.SSL_VERIFYPEER, 0)
 	c.setopt(pycurl.SSL_VERIFYHOST, 0)
 	c.perform()
@@ -115,7 +115,7 @@ used with Cisco UCS to fence machines."
 	show_docs(options, docs)
 
 	### Login
-	res = send_command(options, "<aaaLogin inName=\"" + options["-l"] + "\" inPassword=\"" + options["-p"] + "\" />")
+	res = send_command(options, "<aaaLogin inName=\"" + options["-l"] + "\" inPassword=\"" + options["-p"] + "\" />", int(options["-y"]))
 	result = re_cookie.search(res)
 	if (result == None):	
 		## Cookie is absenting in response
@@ -137,7 +137,7 @@ used with Cisco UCS to fence machines."
 	result = fence_action(None, options, set_power_status, get_power_status, get_list)
 
 	### Logout; we do not care about result as we will end in any case
-	send_command(options, "<aaaLogout inCookie=\"" + options["cookie"] + "\" />")
+	send_command(options, "<aaaLogout inCookie=\"" + options["cookie"] + "\" />", int(options["-Y"]))
 	
 	sys.exit(result)
 


More information about the cluster-commits mailing list