provision: If --targetdir has been specified then we must always reset posix:eadb...
authorAndrew Bartlett <abartlet@samba.org>
Tue, 25 Jun 2019 04:12:47 +0000 (16:12 +1200)
committerGary Lockyer <gary@samba.org>
Tue, 2 Jul 2019 02:23:09 +0000 (02:23 +0000)
This is required because otherwise this may have been set previously by another
part of selftest thanks to the global loadparm and the running of multiple
samba-tool tests within the same python process.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
python/samba/provision/__init__.py

index d78222845ba99620b43dc03b4498e34aafea6658..ffca9f2aab5372fcabd6449afc3dd511c9ba2cc6 100644 (file)
@@ -774,18 +774,24 @@ def make_smbconf(smbconf, hostname, domain, realm, targetdir,
         lp.set("binddns dir", global_settings["binddns dir"])
 
     if eadb:
-        if use_ntvfs and not lp.get("posix:eadb"):
+        if use_ntvfs:
             if targetdir is not None:
                 privdir = os.path.join(targetdir, "private")
-            else:
+                lp.set("posix:eadb",
+                       os.path.abspath(os.path.join(privdir, "eadb.tdb")))
+            elif not lp.get("posix:eadb"):
                 privdir = lp.get("private dir")
-            lp.set("posix:eadb", os.path.abspath(os.path.join(privdir, "eadb.tdb")))
-        elif not use_ntvfs and not lp.get("xattr_tdb:file"):
+                lp.set("posix:eadb",
+                       os.path.abspath(os.path.join(privdir, "eadb.tdb")))
+        else:
             if targetdir is not None:
                 statedir = os.path.join(targetdir, "state")
-            else:
+                lp.set("xattr_tdb:file",
+                       os.path.abspath(os.path.join(statedir, "xattr.tdb")))
+            elif not lp.get("xattr_tdb:file"):
                 statedir = lp.get("state directory")
-            lp.set("xattr_tdb:file", os.path.abspath(os.path.join(statedir, "xattr.tdb")))
+                lp.set("xattr_tdb:file",
+                       os.path.abspath(os.path.join(statedir, "xattr.tdb")))
 
     shares = {}
     if serverrole == "active directory domain controller":