summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2008-12-18 17:17:56 +1100
committerAndrew Bartlett <abartlet@samba.org>2008-12-18 17:17:56 +1100
commit7a5b6a2ea194677c59ad6fab0aca3f102b5b2f46 (patch)
tree83757845ad7899e335296c49aec9bd008cca8649 /source4/scripting
parent1a399db01c90753f0f1c70b2987b925c828b1c53 (diff)
downloadsamba-7a5b6a2ea194677c59ad6fab0aca3f102b5b2f46.tar.gz
samba-7a5b6a2ea194677c59ad6fab0aca3f102b5b2f46.tar.bz2
samba-7a5b6a2ea194677c59ad6fab0aca3f102b5b2f46.zip
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.
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/python/samba/provision.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py
index 5da073c563..95bff74e75 100644
--- a/source4/scripting/python/samba/provision.py
+++ b/source4/scripting/python/samba/provision.py
@@ -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