summaryrefslogtreecommitdiff
path: root/source4/scripting/python
diff options
context:
space:
mode:
Diffstat (limited to 'source4/scripting/python')
-rw-r--r--source4/scripting/python/samba/netcmd/dbcheck.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/source4/scripting/python/samba/netcmd/dbcheck.py b/source4/scripting/python/samba/netcmd/dbcheck.py
index 92d27a1189..7840a61725 100644
--- a/source4/scripting/python/samba/netcmd/dbcheck.py
+++ b/source4/scripting/python/samba/netcmd/dbcheck.py
@@ -94,8 +94,11 @@ class cmd_dbcheck(Command):
else:
attrs = attrs.split()
+ started_transaction = False
+
if yes and fix:
samdb.transaction_start()
+ started_transaction = True
try:
chk = dbcheck(samdb, samdb_schema=samdb_schema, verbose=verbose,
fix=fix, yes=yes, quiet=quiet)
@@ -109,10 +112,11 @@ class cmd_dbcheck(Command):
error_count = chk.check_database(DN=DN, scope=search_scope,
controls=controls, attrs=attrs)
except:
- samdb.transaction_cancel()
+ if started_transaction:
+ samdb.transaction_cancel()
raise
- if yes and fix:
+ if started_transaction:
samdb.transaction_commit()
if error_count != 0: