Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=commit... Commit: 1c57218c8735553ba74e1c286295dd0cf95c3d42 Parent: 9b1a7fa8ad83152d729017accf3dff2ffbe90ea3 Author: Marek 'marx' Grac mgrac@redhat.com AuthorDate: Wed Feb 16 15:00:35 2011 +0100 Committer: Marek 'marx' Grac mgrac@redhat.com CommitterDate: Wed Feb 16 15:00:35 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 888063b..2dc18fe 100644 --- a/fence/agents/rsa/fence_rsa.py +++ b/fence/agents/rsa/fence_rsa.py @@ -25,7 +25,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):
cluster-commits@lists.fedorahosted.org