1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-20 08:59:06 +03:00

dbcheck: Cancel transaction if operation fails.

Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Tue Aug  2 01:41:07 CEST 2011 on sn-devel-104
This commit is contained in:
Jelmer Vernooij
2011-08-01 20:04:02 +02:00
parent 0c67efdd68
commit 6eb496cf45

View File

@ -96,16 +96,21 @@ class cmd_dbcheck(Command):
if yes and fix:
samdb.transaction_start()
try:
chk = dbcheck(samdb, samdb_schema=samdb_schema, verbose=verbose,
fix=fix, yes=yes, quiet=quiet)
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)
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()