s4:provision Allow both additional and override prefixmaps in Schema
authorAndrew Bartlett <abartlet@samba.org>
Wed, 9 Jun 2010 22:58:44 +0000 (08:58 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Sat, 12 Jun 2010 01:18:36 +0000 (11:18 +1000)
The idea here is to allow some callers to specify a new prefixMap that
will override the values loaded from the prefixMap.txt.

Andrew Bartlett

source4/scripting/python/samba/provisionbackend.py
source4/scripting/python/samba/schema.py

index 629bc2818973085650e54a0fa63cb2333b030193..b8abc28eaa652727a4cf255eed836bcc3524a2a3 100644 (file)
@@ -604,7 +604,7 @@ class FDSBackend(LDAPBackend):
                 schemadn=self.names.schemadn,
                 serverdn=self.names.serverdn,
                 files=[setup_path("schema_samba4.ldif"), self.samba3_ldif],
-                prefixmap=["1000:1.3.6.1.4.1.7165.2.1", "1001:1.3.6.1.4.1.7165.2.2"])
+                additional_prefixmap=["1000:1.3.6.1.4.1.7165.2.1", "1001:1.3.6.1.4.1.7165.2.2"])
 
     def provision(self):
         from samba.provision import ProvisioningError
index fc4f13193258f1633faebef935d53ed1dc506898..bdc09cfd3a17e0f1062cd99f9622053fa90d3d37 100644 (file)
@@ -53,7 +53,7 @@ def get_schema_descriptor(domain_sid):
 class Schema(object):
 
     def __init__(self, setup_path, domain_sid, invocationid=None, schemadn=None,
-                 serverdn=None, files=None, prefixmap=None, am_rodc=False):
+                 serverdn=None, files=None, override_prefixmap=None, additional_prefixmap=None, am_rodc=False):
         """Load schema for the SamDB from the AD schema files and samba4_schema.ldif
         
         :param samdb: Load a schema into a SamDB.
@@ -92,10 +92,13 @@ class Schema(object):
             setup_path("provision_schema_basedn.ldif"),
             {"SCHEMADN": schemadn, "DESCRIPTOR": descr})
 
-        self.prefixmap_data = open(setup_path("prefixMap.txt"), 'r').read()
+        if override_prefixmap is not None:
+            self.prefixmap_data = override_prefixmap
+        else:
+            self.prefixmap_data = open(setup_path("prefixMap.txt"), 'r').read()
 
-        if prefixmap is not None:
-            for map in prefixmap:
+        if additional_prefixmap is not None:
+            for map in additional_prefixmap:
                 self.prefixmap_data += "%s\n" % map
 
         self.prefixmap_data = b64encode(self.prefixmap_data)