s4:net domainlevel tool - fix up the error handling as Jelmer suggested
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Fri, 14 May 2010 16:59:36 +0000 (18:59 +0200)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Fri, 14 May 2010 17:03:18 +0000 (19:03 +0200)
Sorry, I've copied this from the "ldap.py" test and thought it would work.

source4/scripting/python/samba/netcmd/domainlevel.py

index 72559bb924ea05e7de11da4696458a59b35f4b4c..4278ae5e4aa1a8af54770fcc19d324d77e096336 100644 (file)
@@ -200,7 +200,8 @@ class cmd_domainlevel(Command):
                     try:
                         samdb.modify(m)
                     except LdbError, (num, _):
-                        self.assertEquals(num, ldb.ERR_UNWILLING_TO_PERFORM)
+                        if num != ldb.ERR_UNWILLING_TO_PERFORM:
+                            raise
 
                 # Directly on the base DN
                 m = ldb.Message()
@@ -219,7 +220,8 @@ class cmd_domainlevel(Command):
                 try:
                     samdb.modify(m)
                 except LdbError, (num, _):
-                    self.assertEquals(num, ldb.ERR_UNWILLING_TO_PERFORM)
+                    if num != ldb.ERR_UNWILLING_TO_PERFORM:
+                        raise
 
                 level_domain = new_level_domain
                 msgs.append("Domain function level changed!")