Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 24e278e14a25367b8cb2fce8af484abd > files > 96

cman-2.0.115-96.el5_8.3.src.rpm

From d096e61f7567ada19fb92935ce8341cb87b88171 Mon Sep 17 00:00:00 2001
From: Marek 'marx' Grac <mgrac@redhat.com>
Date: Fri, 16 Jul 2010 10:39:53 +0200
Subject: [PATCH] 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()
-- 
1.6.0.6