From: Andrew Bartlett Date: Mon, 20 May 2019 04:29:10 +0000 (+1200) Subject: sambaundoguididx: Add flags=ldb.FLG_DONT_CREATE_DB and port to Python3 X-Git-Tag: samba-4.9.14~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f3f259e73692eeba1c7261886350118aa7e3d6ca;p=thirdparty%2Fsamba.git sambaundoguididx: Add flags=ldb.FLG_DONT_CREATE_DB and port to Python3 In py3 we need to add an extra str() around the returned ldb value to enable .split() to be used. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13978 Signed-off-by: Andrew Bartlett Reviewed By: Noel Power Autobuild-User(master): Noel Power Autobuild-Date(master): Thu May 23 14:25:52 UTC 2019 on sn-devel-184 (cherry picked from commit 1a9da378a1505daff498be6d6355debd73526a1a) --- diff --git a/source4/scripting/bin/sambaundoguididx b/source4/scripting/bin/sambaundoguididx index adff232e022..9a38851b421 100755 --- a/source4/scripting/bin/sambaundoguididx +++ b/source4/scripting/bin/sambaundoguididx @@ -34,7 +34,9 @@ if opts.H is None: else: url = opts.H -samdb = ldb.Ldb(url=url, options=["modules:"]) +samdb = ldb.Ldb(url=url, + flags=ldb.FLG_DONT_CREATE_DB, + options=["modules:"]) partitions = samdb.search(base="@PARTITION", scope=ldb.SCOPE_BASE, @@ -58,10 +60,11 @@ privatedir = os.path.dirname(url) dbs = [] for part in partitions[0]['partition']: - tdbname = part.split(":")[1] - tdbpath = os.path.join(privatedir, tdbname) - - db = ldb.Ldb(url=tdbpath, options=["modules:"]) + dbname = str(part).split(":")[1] + dbpath = os.path.join(privatedir, dbname) + db = ldb.Ldb(url="ldb://" + dbpath, + options=["modules:"], + flags=ldb.FLG_DONT_CREATE_DB) db.transaction_start() db.modify(modmsg) dbs.append(db) @@ -73,7 +76,8 @@ samdb.transaction_commit() print("Re-opening with the full DB stack") samdb = SamDB(url=url, - lp=lp_ctx) + flags=ldb.FLG_DONT_CREATE_DB, + lp=lp_ctx) print("Re-triggering another re-index") chk = dbcheck(samdb)