diff options
author | Andrew Tridgell <tridge@samba.org> | 2011-03-28 15:32:41 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-03-29 00:00:22 +0200 |
commit | f4e3ccfe9e09904e548fe715dd784ad5d7f68b0d (patch) | |
tree | be600ea56a969478b4d364545aecbf3c2ebd4e3f /source4 | |
parent | 07b6f75bc1eb6d4554b29f41ed1fd623bd4f4bea (diff) | |
download | samba-f4e3ccfe9e09904e548fe715dd784ad5d7f68b0d.tar.gz samba-f4e3ccfe9e09904e548fe715dd784ad5d7f68b0d.tar.bz2 samba-f4e3ccfe9e09904e548fe715dd784ad5d7f68b0d.zip |
s4-fsmo: nicer error messages on failed FSMO transfers
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4')
-rw-r--r-- | source4/scripting/python/samba/netcmd/fsmo.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/source4/scripting/python/samba/netcmd/fsmo.py b/source4/scripting/python/samba/netcmd/fsmo.py index df6bb20ba3..ff33491194 100644 --- a/source4/scripting/python/samba/netcmd/fsmo.py +++ b/source4/scripting/python/samba/netcmd/fsmo.py @@ -88,7 +88,12 @@ all=all of the above"""), "becomeSchemaMaster") else: raise CommandError("Invalid FSMO role.") - samdb.modify(m) + try: + samdb.modify(m) + except LdbError, (num, msg): + raise CommandError("Failed to initiate transfer: %s" % msg) + print("Scheduled FSMO transfer - use 'fsmo show' and 'drs showrepl' for result") + def seize_role(self, role, samdb, force): res = samdb.search("", @@ -116,19 +121,21 @@ all=all of the above"""), self.transfer_role(role, samdb) except LdbError, (num, _): #transfer failed, use the big axe... - self.message("Transfer unsuccessfull, seizing...") + self.message("Transfer unsuccessful, seizing...") m["fSMORoleOwner"]= ldb.MessageElement( serviceName, ldb.FLAG_MOD_REPLACE, "fSMORoleOwner") - samdb.modify(m) - else: - self.message("Transfer succeeded.") else: self.message("Will not attempt transfer, seizing...") m["fSMORoleOwner"]= ldb.MessageElement( serviceName, ldb.FLAG_MOD_REPLACE, "fSMORoleOwner") + try: samdb.modify(m) + except LdbError, (num, msg): + raise CommandError("Failed to initiate role seize: %s" % msg) + print("Scheduled FSMO transfer - use 'fsmo show' and 'drs showrepl' for result") + def run(self, subcommand, force=None, url=None, role=None, credopts=None, sambaopts=None, versionopts=None): |