diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2012-02-25 17:55:52 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2012-02-25 20:39:05 +0100 |
commit | 2fd10469c1ad55234d5350b10373b52f0bfd2cd0 (patch) | |
tree | ab648b358ef73a6f6203f3b79828f011703d0dfd /source4/scripting/python | |
parent | 9ecc68abe707506b7dc10ce580c7c2ef6b95a785 (diff) | |
download | samba-2fd10469c1ad55234d5350b10373b52f0bfd2cd0.tar.gz samba-2fd10469c1ad55234d5350b10373b52f0bfd2cd0.tar.bz2 samba-2fd10469c1ad55234d5350b10373b52f0bfd2cd0.zip |
provision: Properly close ldb transactions.
Diffstat (limited to 'source4/scripting/python')
-rw-r--r-- | source4/scripting/python/samba/provision/__init__.py | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/source4/scripting/python/samba/provision/__init__.py b/source4/scripting/python/samba/provision/__init__.py index d37176007b..fba009c286 100644 --- a/source4/scripting/python/samba/provision/__init__.py +++ b/source4/scripting/python/samba/provision/__init__.py @@ -1503,19 +1503,24 @@ def provision_fill(samdb, secrets_ldb, logger, names, paths, logger.info("Fixing provision GUIDs") chk = dbcheck(samdb, samdb_schema=samdb, verbose=False, fix=True, yes=True, quiet=True) samdb.transaction_start() - # a small number of GUIDs are missing because of ordering issues in the - # provision code - for schema_obj in ['CN=Domain', 'CN=Organizational-Person', 'CN=Contact', 'CN=inetOrgPerson']: - chk.check_database(DN="%s,%s" % (schema_obj, names.schemadn), - scope=ldb.SCOPE_BASE, attrs=['defaultObjectCategory']) - chk.check_database(DN="CN=IP Security,CN=System,%s" % names.domaindn, - scope=ldb.SCOPE_ONELEVEL, - attrs=['ipsecOwnersReference', - 'ipsecFilterReference', - 'ipsecISAKMPReference', - 'ipsecNegotiationPolicyReference', - 'ipsecNFAReference']) - samdb.transaction_commit() + try: + # a small number of GUIDs are missing because of ordering issues in the + # provision code + for schema_obj in ['CN=Domain', 'CN=Organizational-Person', 'CN=Contact', 'CN=inetOrgPerson']: + chk.check_database(DN="%s,%s" % (schema_obj, names.schemadn), + scope=ldb.SCOPE_BASE, attrs=['defaultObjectCategory']) + chk.check_database(DN="CN=IP Security,CN=System,%s" % names.domaindn, + scope=ldb.SCOPE_ONELEVEL, + attrs=['ipsecOwnersReference', + 'ipsecFilterReference', + 'ipsecISAKMPReference', + 'ipsecNegotiationPolicyReference', + 'ipsecNFAReference']) + except: + samdb.transaction_cancel() + raise + else: + samdb.transaction_commit() _ROLES_MAP = { |