r22756: Make it easier to setup an LDAP replica. Provision with
[jra/samba/.git] / source4 / scripting / libjs / provision.js
index 6af753e7eb63eaf921f43962402b81740c005d0f..948c02470df868a77aa7a9cf12adbc7d5faa195a 100644 (file)
@@ -453,7 +453,7 @@ function provision_fix_subobj(subobj, message, paths)
        return true;
 }
 
-function provision_become_dc(subobj, message, paths, session_info)
+function provision_become_dc(subobj, message, erase, paths, session_info)
 {
        var lp = loadparm_init();
        var sys = sys_init();
@@ -478,8 +478,10 @@ function provision_become_dc(subobj, message, paths, session_info)
        message("Setting up " + paths.samdb + " rootDSE\n");
        setup_add_ldif("provision_rootdse_add.ldif", info, samdb, false);
 
-       message("Erasing data from partitions\n");
-       ldb_erase_partitions(info, samdb, undefined);
+       if (erase) {
+               message("Erasing data from partitions\n");
+               ldb_erase_partitions(info, samdb, undefined);
+       }
 
        message("Setting up " + paths.samdb + " indexes\n");
        setup_add_ldif("provision_index.ldif", info, samdb, false);