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

Marek Grác marx at fedoraproject.org
Fri Jul 16 10:13:01 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=d096e61f7567ada19fb92935ce8341cb87b88171
Commit:        d096e61f7567ada19fb92935ce8341cb87b88171
Parent:        c0d08ea227d2c502519abff654b6b2881f7891b6
Author:        Marek 'marx' Grac <mgrac at redhat.com>
AuthorDate:    Fri Jul 16 10:39:53 2010 +0200
Committer:     Marek 'marx' Grac <mgrac at redhat.com>
CommitterDate: Fri Jul 16 12:11:27 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#576176
---
 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 a782250..a6010c8 100755
--- a/fence/agents/ilo/fence_ilo.py
+++ b/fence/agents/ilo/fence_ilo.py
@@ -27,7 +27,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