From 052da4e4d77ceb0307ad2477f2bc4a17334d6565 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 14 Aug 2009 08:46:13 +1000 Subject: [PATCH] s4:python Allow 'no such object' on the delete of the DN This fixes the recursive delete in erase_partitions() For reasons I cannot understand, it is possible to get 'no such object' trying to delete a DN I just search for without error. Oh well... Andrew Bartlett --- source4/scripting/python/samba/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source4/scripting/python/samba/__init__.py b/source4/scripting/python/samba/__init__.py index 5e4fa7223f55..097d96a3f4ec 100644 --- a/source4/scripting/python/samba/__init__.py +++ b/source4/scripting/python/samba/__init__.py @@ -158,7 +158,11 @@ class Ldb(ldb.Ldb): for msg in res: erase_recursive(self, msg.dn) - self.delete(dn) + try: + self.delete(dn) + except ldb.LdbError, (ldb.ERR_NO_SUCH_OBJECT, _): + # Ignore no such object errors + pass res = self.search("", ldb.SCOPE_BASE, "(objectClass=*)", ["namingContexts"]) -- 2.34.1