On 10/06/2010 03:37 AM, Rob Crittenden wrote:
Pavel Zuna wrote:
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

The migration plugin and pending automount plugin patch already define
an attribute for continuous operation though it is named continue
instead. We should pick one and be consistent. I like continue because
it's easier to type.

rob

Fixed version attached.

Pavel
>From d8bc23e86458e91616b7ab2ed9cd26983cecc24c 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/3] 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..2335a7a 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('continue',
+            cli_name='continue',
+            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