1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-15 16:59:09 +03:00

Handle different failure modes when we wipe the db in provision

We didn't handle the mode where we can't load the main sam.ldb due to
the modules being 'wrong', and when we did remove the file, we didn't
wipe the partitions.
This commit is contained in:
Andrew Bartlett
2008-12-18 17:17:56 +11:00
parent 1a399db01c
commit 7a5b6a2ea1

View File

@ -432,17 +432,18 @@ def setup_samdb_partitions(samdb_path, setup_path, message, lp, session_info,
"""
assert session_info is not None
samdb = SamDB(samdb_path, session_info=session_info,
credentials=credentials, lp=lp)
# Wipes the database
try:
samdb = SamDB(samdb_path, session_info=session_info,
credentials=credentials, lp=lp)
# Wipes the database
samdb.erase()
except:
os.unlink(samdb_path)
samdb = SamDB(samdb_path, session_info=session_info,
credentials=credentials, lp=lp)
samdb = SamDB(samdb_path, session_info=session_info,
credentials=credentials, lp=lp)
# Wipes the database
samdb.erase()
#Add modules to the list to activate them by default
#beware often order is important