s4-ldb: allow ldap.py test suite to run directly against a file
authorAndrew Tridgell <tridge@samba.org>
Wed, 18 Nov 2009 02:27:50 +0000 (13:27 +1100)
committerAndrew Tridgell <tridge@samba.org>
Fri, 20 Nov 2009 00:34:38 +0000 (11:34 +1100)
This makes it much easier to debug (as you can break in the ldb
modules by running gdb on /usr/bin/python)

source4/lib/ldb/tests/python/ldap.py

index a77a7777df89cab227c855df3593eaa9a431660b..ed8e663ac8c96ab2cf9c6a2e97f7a5da1fb38853 100755 (executable)
@@ -8,6 +8,7 @@ import sys
 import time
 import random
 import base64
+import os
 
 sys.path.append("bin/python")
 sys.path.append("../lib/subunit/python")
@@ -1981,7 +1982,10 @@ name: """ + object_name + """
         self.delete_force(self.ldb, "cn=%s,cn=Users,%s" % (object_name, self.base_dn))
 
 if not "://" in host:
-    host = "ldap://%s" % host
+    if os.path.isfile(host):
+        host = "tdb://%s" % host
+    else:
+        host = "ldap://%s" % host
 
 ldb = Ldb(host, credentials=creds, session_info=system_session(), lp=lp)
 gc_ldb = Ldb("%s:3268" % host, credentials=creds,