All LDAPMultiQuery sub-classes (currently only LDAPDelete) now have the --continuous flag (off by default). The flag should indicate that the command shouldn't stop on errors and continue operation with the next primary key on the arguments lists.

This effectively fixes *-del unit tests, because continuous mode is off by default. (It was on before this patch and there was no option to turn it off.)

Ticket #321

Pavel
>From 3c6ad32fd6da79207184c6fbc1fca2126e20f7bd Mon Sep 17 00:00:00 2001
From: Pavel Zuna <pz...@redhat.com>
Date: Tue, 5 Oct 2010 14:34:47 -0400
Subject: [PATCH 2/2] Add 'continuous' mode to LDAPDelete. Fix *-del unit tests.

Ticket #321
---
 ipalib/plugins/baseldap.py |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py
index 42d9017..a4dff46 100644
--- a/ipalib/plugins/baseldap.py
+++ b/ipalib/plugins/baseldap.py
@@ -353,6 +353,13 @@ class LDAPMultiQuery(LDAPQuery):
     """
     Base class for commands that need to retrieve one or more existing entries.
     """
+    takes_options = (
+        Flag('continuous',
+            cli_name='continuous',
+            doc=_('Continuous mode: Don\'t stop on errors.'),
+        ),
+    )
+
     def get_args(self):
         for key in self.obj.get_ancestor_primary_keys():
             yield key
@@ -594,6 +601,8 @@ class LDAPDelete(LDAPMultiQuery):
                 if not delete_entry(pkey):
                     result = False
             except errors.ExecutionError:
+                if not options.get('continuous', False):
+                    raise
                 failed.append(pkey)
             else:
                 deleted.append(pkey)
-- 
1.7.1.1

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to