summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2009-08-25 16:27:20 +1000
committerAndrew Bartlett <abartlet@samba.org>2009-08-25 16:28:44 +1000
commit436d8b6e06c555b2f3dabad8218f08b713e7664c (patch)
tree33d0ab2d01ec1bac142f18ac708be4b9dcc338b0
parent6542a084a5dee239866f7d327c47afe2fc3efc6a (diff)
downloadsamba-436d8b6e06c555b2f3dabad8218f08b713e7664c.tar.gz
samba-436d8b6e06c555b2f3dabad8218f08b713e7664c.tar.bz2
samba-436d8b6e06c555b2f3dabad8218f08b713e7664c.zip
s4:python Fix the reprovision test by deleting 'deleted' objects too.
We were failing because CN=Deleted Objects, which is marked as 'deleted' itself, could not be re-added in a reprovision. Andrew Bartlett
-rw-r--r--source4/scripting/python/samba/__init__.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/source4/scripting/python/samba/__init__.py b/source4/scripting/python/samba/__init__.py
index 59a6e00c5d..69a0320be7 100644
--- a/source4/scripting/python/samba/__init__.py
+++ b/source4/scripting/python/samba/__init__.py
@@ -135,17 +135,19 @@ class Ldb(ldb.Ldb):
def erase_except_schema_controlled(self):
"""Erase this ldb, removing all records, except those that are controlled by Samba4's schema."""
basedn = ""
- # Delete the 'visible' records
+ # Delete the 'visible' records, and the invisble 'deleted' records (if this DB supports it)
for msg in self.search(basedn, ldb.SCOPE_SUBTREE,
- "(&(|(objectclass=*)(distinguishedName=*))(!(distinguishedName=@BASEINFO)))",
- ["distinguishedName"]):
+ "(&(|(objectclass=*)(distinguishedName=*))(!(distinguishedName=@BASEINFO)))",
+ [], controls=["show_deleted:0"]):
try:
self.delete(msg.dn)
except ldb.LdbError, (ldb.ERR_NO_SUCH_OBJECT, _):
# Ignore no such object errors
pass
-
- res = self.search(basedn, ldb.SCOPE_SUBTREE, "(&(|(objectclass=*)(distinguishedName=*))(!(distinguishedName=@BASEINFO)))", ["distinguishedName"])
+
+ res = self.search(basedn, ldb.SCOPE_SUBTREE,
+ "(&(|(objectclass=*)(distinguishedName=*))(!(distinguishedName=@BASEINFO)))",
+ [], controls=["show_deleted:0"])
assert len(res) == 0
# delete the specials
@@ -175,7 +177,8 @@ class Ldb(ldb.Ldb):
def erase_recursive(self, dn):
try:
- res = self.search(base=dn, scope=ldb.SCOPE_ONELEVEL, attrs=[])
+ res = self.search(base=dn, scope=ldb.SCOPE_ONELEVEL, attrs=[],
+ controls=["show_deleted:0"])
except ldb.LdbError, (ldb.ERR_NO_SUCH_OBJECT, _):
# Ignore no such object errors
return