From: Gary Lockyer Date: Thu, 18 Jan 2018 20:16:04 +0000 (+1300) Subject: remove_dc.py: Abort transaction before throwing an exception X-Git-Tag: talloc-2.1.12~261 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bca8ac0296b9049fcc126bd775eace265ecc1ced;p=thirdparty%2Fsamba.git remove_dc.py: Abort transaction before throwing an exception Signed-off-by: Gary Lockyer Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/remove_dc.py b/python/samba/remove_dc.py index da3b628ae9f..6b86a554efa 100644 --- a/python/samba/remove_dc.py +++ b/python/samba/remove_dc.py @@ -394,6 +394,7 @@ def remove_dc(samdb, logger, dc_name): % (dc_name, samdb.domain_dns_name()), estr) if (len(server_msgs) == 0): + samdb.transaction_cancel() raise DemoteException("%s is not an AD DC in %s" % (dc_name, samdb.domain_dns_name())) server_dn = server_msgs[0].dn @@ -412,6 +413,7 @@ def remove_dc(samdb, logger, dc_name): ntds_msgs = [] pass else: + samdb.transaction_cancel() raise DemoteException("Failure checking if %s is an NTDS DSA in %s: " % (ntds_dn, samdb.domain_dns_name()), estr) @@ -419,6 +421,7 @@ def remove_dc(samdb, logger, dc_name): # object, just remove the server object located above if (len(ntds_msgs) == 0): if server_dn is None: + samdb.transaction_cancel() raise DemoteException("%s is not an AD DC in %s" % (dc_name, samdb.domain_dns_name()))