cluster: RHEL6 - fence_ilo: will throw exception if user does not have power priviledges

Fabio M. Di Nitto fabbione at fedoraproject.org
Wed Jul 21 07:18:27 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=6477f54d3c8e2647677661f374db97c2f264c2f4
Commit:        6477f54d3c8e2647677661f374db97c2f264c2f4
Parent:        d2a6476f69fedd569b61e1a790cba3ce9ceb9f15
Author:        Marek 'marx' Grac <mgrac at redhat.com>
AuthorDate:    Fri Jul 16 10:39:53 2010 +0200
Committer:     Fabio M. Di Nitto <fdinitto at redhat.com>
CommitterDate: Wed Jul 21 09:16:38 2010 +0200

fence_ilo: will throw exception if user does not have power priviledges

User will receive error message instead of python traceback

Patch by Shane Bradley

Resolves: rhbz#615255
---
 fence/agents/ilo/fence_ilo.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/fence/agents/ilo/fence_ilo.py b/fence/agents/ilo/fence_ilo.py
index b68f4e4..f70dc9c 100755
--- a/fence/agents/ilo/fence_ilo.py
+++ b/fence/agents/ilo/fence_ilo.py
@@ -26,7 +26,12 @@ def get_power_status(conn, options):
 		" PASSWORD = \"" + options["-p"] + "\">\r\n")
 	conn.send("<SERVER_INFO MODE = \"read\"><GET_HOST_POWER_STATUS/>\r\n")
 	conn.send("</SERVER_INFO></LOGIN>\r\n")
-	conn.log_expect(options, "HOST_POWER=\"(.*?)\"", int(options["-g"]))
+	try:
+		conn.log_expect(options, "HOST_POWER=\"(.*?)\"", int(options["-g"]))
+	except pexpect.EOF, e:
+		fail(EC_STATUS)
+	except pexpect.TIMEOUT, e:
+		fail(EC_TIMED_OUT)
 
 	status = conn.match.group(1)
 	return status.lower().strip()


More information about the cluster-commits mailing list