summaryrefslogtreecommitdiffstats
path: root/source4/scripting/python/samba/samdb.py
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-04-20 11:48:51 +1000
committerAndrew Bartlett <abartlet@samba.org>2010-04-20 12:11:18 +1000
commitea5cf7ce05f295c34d0fca194ed7d8691f1e04ab (patch)
tree702748388bc619ee4de72645d50d429cb60a5269 /source4/scripting/python/samba/samdb.py
parent60d36929189eb8c5749431a4d90266b34c26b0c3 (diff)
downloadsamba-ea5cf7ce05f295c34d0fca194ed7d8691f1e04ab.tar.gz
samba-ea5cf7ce05f295c34d0fca194ed7d8691f1e04ab.tar.xz
samba-ea5cf7ce05f295c34d0fca194ed7d8691f1e04ab.zip
s4:provision Pass in the invoication ID and NTDS Settings DN to Schema()
By putting these values into the cache on the LDB, this reduces some of the noise in provision, particularly with the LDAP backend. Andrew Bartlett
Diffstat (limited to 'source4/scripting/python/samba/samdb.py')
-rw-r--r--source4/scripting/python/samba/samdb.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/source4/scripting/python/samba/samdb.py b/source4/scripting/python/samba/samdb.py
index d41b3ec6378..dd3824db0c2 100644
--- a/source4/scripting/python/samba/samdb.py
+++ b/source4/scripting/python/samba/samdb.py
@@ -37,9 +37,11 @@ class SamDB(samba.Ldb):
"""The SAM database."""
def __init__(self, url=None, lp=None, modules_dir=None, session_info=None,
- credentials=None, flags=0, options=None, global_schema=True):
+ credentials=None, flags=0, options=None, global_schema=True, auto_connect=True):
self.lp = lp
- if url is None:
+ if not auto_connect:
+ url = None
+ elif url is None and lp is not None:
url = lp.get("sam database")
super(SamDB, self).__init__(url=url, lp=lp, modules_dir=modules_dir,
@@ -50,7 +52,10 @@ class SamDB(samba.Ldb):
dsdb.dsdb_set_global_schema(self)
def connect(self, url=None, flags=0, options=None):
- super(SamDB, self).connect(url=self.lp.private_path(url), flags=flags,
+ if self.lp is not None:
+ url = self.lp.private_path(url)
+
+ super(SamDB, self).connect(url=url, flags=flags,
options=options)
def domain_dn(self):
@@ -261,6 +266,15 @@ accountExpires: %u
"Get the invocation_id id"
return dsdb.samdb_ntds_invocation_id(self)
+ def set_ntds_settings_dn(self, ntds_settings_dn):
+ """Set the NTDS Settings DN, as would be returned on the dsServiceName rootDSE attribute
+
+ This allows the DN to be set before the database fully exists
+
+ :param ntds_settings_dn: The new DN to use
+ """
+ dsdb.samdb_set_ntds_settings_dn(self, ntds_settings_dn)
+
invocation_id = property(get_invocation_id, set_invocation_id)
domain_sid = property(get_domain_sid, set_domain_sid)