fence-agents: master - fence_rsb: Raise exceptions not strings

Marek Grác marx at fedoraproject.org
Fri Jul 9 11:15:32 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=commitdiff;h=e15b3b16d8b1a8a4ef9fb7dd0473b0c28edea77f
Commit:        e15b3b16d8b1a8a4ef9fb7dd0473b0c28edea77f
Parent:        7525b2d647f91794cbe3fe6e54fcba7ba4d03f57
Author:        Guido Günther <agx at sigxcpu.org>
AuthorDate:    Fri Jul 2 13:42:57 2010 +0200
Committer:     Marek 'marx' Grac <mgrac at redhat.com>
CommitterDate: Fri Jul 9 12:10:50 2010 +0200

fence_rsb: Raise exceptions not strings

otherwise we'll see in python 2.6

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: exceptions must be old-style classes or derived from BaseException, not str

Signed-off-by: Marek 'marx' Grac <mgrac at redhat.com>
Resolves: rhbz#612941
---
 fence/agents/rsb/fence_rsb.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fence/agents/rsb/fence_rsb.py b/fence/agents/rsb/fence_rsb.py
index 8397f36..759ae2d 100644
--- a/fence/agents/rsb/fence_rsb.py
+++ b/fence/agents/rsb/fence_rsb.py
@@ -167,7 +167,7 @@ def main():
       if 'passwd_script' in params:
         passwd_script = params['passwd_script']
       if passwd == "" and passwd_script == "":
-        raise "missing password"
+        raise Exception, "missing password"
     except KeyError, e:
       os.write(standard_err, "FENCE: Missing passwd param for fence_rsb...exiting")
       sys.exit(1)
@@ -197,11 +197,11 @@ def main():
   if len(passwd_script):
     try:
       if not os.access(passwd_script, os.X_OK):
-        raise 'script not executable'
+        raise Exception, 'script not executable'
       p = os.popen(passwd_script, 'r', 1024)
       passwd_scr = p.readline().strip()
       if p.close() != None:
-        raise 'script failed'
+        raise Exception, 'script failed'
     except:
       sys.stderr.write('password-script "%s" failed\n' % passwd_script)
       passwd_scr = ''


More information about the cluster-commits mailing list