cluster: RHEL6 - fence_rsb: Raise exceptions not strings

Fabio M. Di Nitto fabbione at fedoraproject.org
Wed Jul 21 07:18:24 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=d2a6476f69fedd569b61e1a790cba3ce9ceb9f15
Commit:        d2a6476f69fedd569b61e1a790cba3ce9ceb9f15
Parent:        c5832316e3ae6baa1f50f5871deaa1dde36a2129
Author:        Guido Günther <agx at sigxcpu.org>
AuthorDate:    Fri Jul 2 13:42:57 2010 +0200
Committer:     Fabio M. Di Nitto <fdinitto at redhat.com>
CommitterDate: Wed Jul 21 09:16:08 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