Fix templates.ldb reprovision handling.
authorAndrew Bartlett <abartlet@samba.org>
Tue, 19 Aug 2008 01:43:41 +0000 (11:43 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 19 Aug 2008 01:43:41 +0000 (11:43 +1000)
This sets the attributes in a seperate transaction, and allows a
forced delete of the whole file.

Andrew Bartlett
(This used to be commit 423db2468ba3dac89cebc59c8498c0b08c5f3d7b)

source4/scripting/python/samba/provision.py
source4/setup/provision_templates.ldif
source4/setup/provision_templates_init.ldif [new file with mode: 0644]

index 4f7fbfc6e6873e747264243016e77fac19cc65ea..836509a620dbbcf9aed638ec92d5d5121d1b508a 100644 (file)
@@ -617,7 +617,17 @@ def setup_templatesdb(path, setup_path, session_info, credentials, lp):
     """
     templates_ldb = SamDB(path, session_info=session_info,
                           credentials=credentials, lp=lp)
-    templates_ldb.erase()
+    # Wipes the database
+    try:
+        templates_ldb.erase()
+    except:
+        os.unlink(path)
+
+    templates_ldb.load_ldif_file_add(setup_path("provision_templates_init.ldif"))
+
+    templates_ldb = SamDB(path, session_info=session_info,
+                          credentials=credentials, lp=lp)
+
     templates_ldb.load_ldif_file_add(setup_path("provision_templates.ldif"))
 
 
index 8f4ed082525a7d6ee97dec2af37910b90d2759f7..04257549d56943410af495d6a58b722057e04654 100644 (file)
@@ -2,16 +2,6 @@
 # Templates to be put in templates.ldb.  Not part of main samdb any more.
 ###
 
-dn: @OPTIONS
-checkBaseOnSearch: TRUE
-
-dn: @INDEXLIST
-@IDXATTR: cn
-
-dn: @ATTRIBUTES
-cn: CASE_INSENSITIVE
-dn: CASE_INSENSITIVE
-
 dn: CN=Templates
 objectClass: top
 objectClass: container
diff --git a/source4/setup/provision_templates_init.ldif b/source4/setup/provision_templates_init.ldif
new file mode 100644 (file)
index 0000000..6d6a3c2
--- /dev/null
@@ -0,0 +1,10 @@
+dn: @OPTIONS
+checkBaseOnSearch: TRUE
+
+dn: @INDEXLIST
+@IDXATTR: cn
+
+dn: @ATTRIBUTES
+cn: CASE_INSENSITIVE
+dn: CASE_INSENSITIVE
+