Gitweb:
http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 415fc5f19db6780c76dfc00f680a9617dacd7b31
Parent: a93f8e62758d78e50877efbfe55a1101088a141d
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Wed Feb 16 15:00:35 2011 +0100
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Wed Feb 16 15:18:19 2011 +0100
fence_rsa: Better error handling
In some special cases (reason is not known yet) fence agent for RSA fails to
get status because it can't find pattern 'Power: (.*)'. After applying this
patch agent will end with proper error message instead of python backtrace.
Resolves: rhbz#652619
---
fence/agents/rsa/fence_rsa.py | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/fence/agents/rsa/fence_rsa.py b/fence/agents/rsa/fence_rsa.py
index 36a9f04..33c7fe9 100755
--- a/fence/agents/rsa/fence_rsa.py
+++ b/fence/agents/rsa/fence_rsa.py
@@ -26,7 +26,12 @@ def get_power_status(conn, options):
except pexpect.TIMEOUT:
fail(EC_TIMED_OUT)
- status = re.compile("Power: (.*)",
re.IGNORECASE).search(conn.before).group(1)
+ match = re.compile("Power: (.*)", re.IGNORECASE).search(conn.before)
+ if (match != None):
+ status = match.group(1)
+ else:
+ status = "undefined"
+
return status.lower().strip()
def set_power_status(conn, options):