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

Marek Grác marx at fedoraproject.org
Fri Jul 16 09:51:22 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=d6da8cc3ae8121074ed9330db0f236ecdd4b322f
Commit:        d6da8cc3ae8121074ed9330db0f236ecdd4b322f
Parent:        517771b27fc41a95a20df5f80f0fc45ed1743911
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 11:49:22 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