summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/scripting/python/samba/netcmd/dbcheck.py25
1 files changed, 15 insertions, 10 deletions
diff --git a/source4/scripting/python/samba/netcmd/dbcheck.py b/source4/scripting/python/samba/netcmd/dbcheck.py
index 3f379c0cd4..2a175f3525 100644
--- a/source4/scripting/python/samba/netcmd/dbcheck.py
+++ b/source4/scripting/python/samba/netcmd/dbcheck.py
@@ -96,16 +96,21 @@ class cmd_dbcheck(Command):
if yes and fix:
samdb.transaction_start()
-
- chk = dbcheck(samdb, samdb_schema=samdb_schema, verbose=verbose, fix=fix, yes=yes, quiet=quiet)
-
- if reindex:
- print("Re-indexing...")
- error_count = 0
- if chk.reindex_database():
- print("completed re-index OK")
- else:
- error_count = chk.check_database(DN=DN, scope=search_scope, controls=controls, attrs=attrs)
+ try:
+ chk = dbcheck(samdb, samdb_schema=samdb_schema, verbose=verbose,
+ fix=fix, yes=yes, quiet=quiet)
+
+ if reindex:
+ print("Re-indexing...")
+ error_count = 0
+ if chk.reindex_database():
+ print("completed re-index OK")
+ else:
+ error_count = chk.check_database(DN=DN, scope=search_scope,
+ controls=controls, attrs=attrs)
+ except:
+ samdb.transaction_cancel()
+ raise
if yes and fix:
samdb.transaction_commit()