summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2010-06-16 11:25:19 +0400
committerJelmer Vernooij <jelmer@samba.org>2010-06-20 00:43:09 +0200
commit38a26f79eaded8364a178ba2aac71e64f5d60be5 (patch)
tree85faedc8b338624d2ae7fc290224f2b5d7d8b7fb
parentc4f7b0e5f673943dfdda88f3e289912778a07a33 (diff)
downloadsamba-38a26f79eaded8364a178ba2aac71e64f5d60be5.tar.gz
samba-38a26f79eaded8364a178ba2aac71e64f5d60be5.tar.bz2
samba-38a26f79eaded8364a178ba2aac71e64f5d60be5.zip
s4 upgradeprovision: Make grouped commit / rollback more resistant to unexpected problems
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
-rwxr-xr-xsource4/scripting/python/samba/upgradehelpers.py55
1 files changed, 42 insertions, 13 deletions
diff --git a/source4/scripting/python/samba/upgradehelpers.py b/source4/scripting/python/samba/upgradehelpers.py
index 4cb84ba54f..db6ea560a2 100755
--- a/source4/scripting/python/samba/upgradehelpers.py
+++ b/source4/scripting/python/samba/upgradehelpers.py
@@ -81,39 +81,68 @@ class ProvisionLDB(object):
self.secrets.transaction_start()
self.idmap.transaction_start()
self.privilege.transaction_start()
+# TO BE DONE
# self.hkcr.transaction_start()
# self.hkcu.transaction_start()
# self.hku.transaction_start()
# self.hklm.transaction_start()
def groupedRollback(self):
- self.sam.transaction_cancel()
- self.secrets.transaction_cancel()
- self.idmap.transaction_cancel()
- self.privilege.transaction_cancel()
+ ok = True
+ try:
+ self.sam.transaction_cancel()
+ except:
+ ok = False
+
+ try:
+ self.secrets.transaction_cancel()
+ except:
+ ok = False
+
+ try:
+ self.idmap.transaction_cancel()
+ except:
+ ok = False
+
+ try:
+ self.privilege.transaction_cancel()
+ except:
+ ok = False
+
+ return ok
+# TO BE DONE
# self.hkcr.transaction_cancel()
# self.hkcu.transaction_cancel()
# self.hku.transaction_cancel()
# self.hklm.transaction_cancel()
def groupedCommit(self):
- self.sam.transaction_prepare_commit()
- self.secrets.transaction_prepare_commit()
- self.idmap.transaction_prepare_commit()
- self.privilege.transaction_prepare_commit()
+ try:
+ self.sam.transaction_prepare_commit()
+ self.secrets.transaction_prepare_commit()
+ self.idmap.transaction_prepare_commit()
+ self.privilege.transaction_prepare_commit()
+ except:
+ return self.groupedRollback()
+# TO BE DONE
# self.hkcr.transaction_prepare_commit()
# self.hkcu.transaction_prepare_commit()
# self.hku.transaction_prepare_commit()
# self.hklm.transaction_prepare_commit()
-
- self.sam.transaction_commit()
- self.secrets.transaction_commit()
- self.idmap.transaction_commit()
- self.privilege.transaction_commit()
+ try:
+ self.sam.transaction_commit()
+ self.secrets.transaction_commit()
+ self.idmap.transaction_commit()
+ self.privilege.transaction_commit()
+ except:
+ return self.groupedRollback()
+
+# TO BE DONE
# self.hkcr.transaction_commit()
# self.hkcu.transaction_commit()
# self.hku.transaction_commit()
# self.hklm.transaction_commit()
+ return True
def get_ldbs(paths, creds, session, lp):
"""Return LDB object mapped on most important databases