mirror of
https://github.com/samba-team/samba.git
synced 2025-03-01 04:58:35 +03:00
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. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed By: Noel Power <npower@samba.org> Autobuild-User(master): Noel Power <npower@samba.org> Autobuild-Date(master): Thu May 23 14:25:52 UTC 2019 on sn-devel-184
This commit is contained in:
parent
3b608510e4
commit
1a9da378a1
@ -34,7 +34,9 @@ if opts.H is None:
|
|||||||
else:
|
else:
|
||||||
url = opts.H
|
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",
|
partitions = samdb.search(base="@PARTITION",
|
||||||
scope=ldb.SCOPE_BASE,
|
scope=ldb.SCOPE_BASE,
|
||||||
@ -58,10 +60,11 @@ privatedir = os.path.dirname(url)
|
|||||||
|
|
||||||
dbs = []
|
dbs = []
|
||||||
for part in partitions[0]['partition']:
|
for part in partitions[0]['partition']:
|
||||||
tdbname = part.split(":")[1]
|
dbname = str(part).split(":")[1]
|
||||||
tdbpath = os.path.join(privatedir, tdbname)
|
dbpath = os.path.join(privatedir, dbname)
|
||||||
|
db = ldb.Ldb(url="ldb://" + dbpath,
|
||||||
db = ldb.Ldb(url=tdbpath, options=["modules:"])
|
options=["modules:"],
|
||||||
|
flags=ldb.FLG_DONT_CREATE_DB)
|
||||||
db.transaction_start()
|
db.transaction_start()
|
||||||
db.modify(modmsg)
|
db.modify(modmsg)
|
||||||
dbs.append(db)
|
dbs.append(db)
|
||||||
@ -73,6 +76,7 @@ samdb.transaction_commit()
|
|||||||
|
|
||||||
print("Re-opening with the full DB stack")
|
print("Re-opening with the full DB stack")
|
||||||
samdb = SamDB(url=url,
|
samdb = SamDB(url=url,
|
||||||
|
flags=ldb.FLG_DONT_CREATE_DB,
|
||||||
lp=lp_ctx)
|
lp=lp_ctx)
|
||||||
print("Re-triggering another re-index")
|
print("Re-triggering another re-index")
|
||||||
chk = dbcheck(samdb)
|
chk = dbcheck(samdb)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user