fence-agents: master - fence_ilo: will throw exception if user does not have power priviledges

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


Gitweb:        http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=commitdiff;h=0836ec51f4a916748f4dce0ba39ce0a7d56264b6
Commit:        0836ec51f4a916748f4dce0ba39ce0a7d56264b6
Parent:        e15b3b16d8b1a8a4ef9fb7dd0473b0c28edea77f
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 10:39:53 2010 +0200

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

User will receive error message instead of python traceback

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