fence-agents: master - fence_cisco_ucs: Fix traceback when hostname cannot be resolved to IP address

Marek GrĂ¡c marx at fedoraproject.org
Wed Feb 6 15:27:35 UTC 2013


Gitweb:        http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=ebedf3dfe3a76cc164f590681186b68e0081092e
Commit:        ebedf3dfe3a76cc164f590681186b68e0081092e
Parent:        2424d8c71413d6ba4ace2c002ee80c1f4517b4c8
Author:        Marek 'marx' Grac <mgrac at redhat.com>
AuthorDate:    Wed Feb 6 16:27:01 2013 +0100
Committer:     Marek 'marx' Grac <mgrac at redhat.com>
CommitterDate: Wed Feb 6 16:27:01 2013 +0100

fence_cisco_ucs: Fix traceback when hostname cannot be resolved to IP address

---
 fence/agents/cisco_ucs/fence_cisco_ucs.py |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/fence/agents/cisco_ucs/fence_cisco_ucs.py b/fence/agents/cisco_ucs/fence_cisco_ucs.py
index 9783250..f70a835 100644
--- a/fence/agents/cisco_ucs/fence_cisco_ucs.py
+++ b/fence/agents/cisco_ucs/fence_cisco_ucs.py
@@ -128,10 +128,13 @@ used with Cisco UCS to fence machines."
 		time.sleep(int(options["--delay"]))
 
 	### Login
-	res = send_command(options, "<aaaLogin inName=\"" + options["--username"] + "\" inPassword=\"" + options["--password"] + "\" />", int(options["--login-timeout"]))
-	result = RE_COOKIE.search(res)
-	if (result == None):	
-		## Cookie is absenting in response
+	try:
+		res = send_command(options, "<aaaLogin inName=\"" + options["--username"] + "\" inPassword=\"" + options["--password"] + "\" />", int(options["--login-timeout"]))
+		result = RE_COOKIE.search(res)
+		if (result == None):	
+			## Cookie is absenting in response
+			fail(EC_LOGIN_DENIED)
+	except:
 		fail(EC_LOGIN_DENIED)
 
 	options["cookie"] = result.group(1)


More information about the cluster-commits mailing list