summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-04-07 12:10:09 +0200
committerJelmer Vernooij <jelmer@samba.org>2010-04-07 17:39:59 +0200
commitfeeedf49cfc2edbfdfd0e5512904ea67f2daff11 (patch)
treebca64d85476fbfbeca1f1182e7ad05118e61dce4
parent21ab06f8a233b38bee750250e455416ac0bef13e (diff)
downloadsamba-feeedf49cfc2edbfdfd0e5512904ea67f2daff11.tar.gz
samba-feeedf49cfc2edbfdfd0e5512904ea67f2daff11.tar.xz
samba-feeedf49cfc2edbfdfd0e5512904ea67f2daff11.zip
s4-provision: Proper handling of exceptions, use SamDB class but skip global schema.
-rw-r--r--source4/scripting/python/samba/provision.py27
1 files changed, 17 insertions, 10 deletions
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py
index d23333c66ef..4bef0ed7d40 100644
--- a/source4/scripting/python/samba/provision.py
+++ b/source4/scripting/python/samba/provision.py
@@ -50,6 +50,7 @@ from samba.idmap import IDmapDB
from samba.ntacls import setntacl, dsacl2fsacl
from samba.ndr import ndr_pack,ndr_unpack
from samba.schema import Schema
+from samba.samdb import SamDB
from ms_display_specifiers import read_ms_ldif
from samba.provisionbackend import LDBBackend, ExistingBackend, FDSBackend, OpenLDAPBackend
from provisionexceptions import ProvisioningError, InvalidNetbiosName
@@ -894,8 +895,8 @@ def setup_samdb(path, setup_path, session_info, provision_backend, lp,
samdb.set_opaque_integer("forestFunctionality", forestFunctionality)
samdb.set_opaque_integer("domainControllerFunctionality", domainControllerFunctionality)
- samdb.domain_sid = str(domainsid)
- samdb.invocation_id = invocationid
+ samdb.set_domain_sid(str(domainsid))
+ samdb.set_invocation_id(invocationid)
message("Adding DomainDN: %s" % names.domaindn)
@@ -946,12 +947,18 @@ def setup_samdb(path, setup_path, session_info, provision_backend, lp,
{"SCHEMADN": names.schemadn})
message("Reopening sam.ldb with new schema")
+ except:
+ samdb.transaction_cancel()
+ raise
+ else:
samdb.transaction_commit()
- samdb = SamDB(session_info=admin_session_info,
- credentials=provision_backend.credentials, lp=lp,
- global_schema=False)
- samdb.connect(path)
- samdb.transaction_start()
+
+ samdb = SamDB(session_info=admin_session_info,
+ credentials=provision_backend.credentials, lp=lp,
+ global_schema=False)
+ samdb.connect(path)
+ samdb.transaction_start()
+ try:
samdb.invocation_id = invocationid
message("Setting up sam.ldb configuration data")
@@ -1030,9 +1037,9 @@ def setup_samdb(path, setup_path, session_info, provision_backend, lp,
except:
samdb.transaction_cancel()
raise
-
- samdb.transaction_commit()
- return samdb
+ else:
+ samdb.transaction_commit()
+ return samdb
FILL_FULL = "FULL"