On 11/20/2014 10:03 AM, Jan Cholasta wrote:
Dne 20.11.2014 v 09:51 David Kupka napsal(a):
https://fedorahosted.org/freeipa/ticket/4620

IMO changing the loop to:

    for attr in attr_blacklist:
        entry_attrs.pop(attr, None)

would be better, because LDAPEntry already handles case insensitivity in
attribute names.

This seems better, thanks.
--
David Kupka
From 94293d14e51507819c4296c52d5d8ce4def9a4c8 Mon Sep 17 00:00:00 2001
From: David Kupka <dku...@redhat.com>
Date: Wed, 19 Nov 2014 09:57:59 -0500
Subject: [PATCH] Fix --{user,group}-ignore-attribute in migration plugin.

Ignore case in attribute names.

https://fedorahosted.org/freeipa/ticket/4620
---
 ipalib/plugins/migration.py | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/ipalib/plugins/migration.py b/ipalib/plugins/migration.py
index 6b630a464f0be163e82de95afe3a74b22889574b..fa3d512bf1434c7d349713f78c292b481021303a 100644
--- a/ipalib/plugins/migration.py
+++ b/ipalib/plugins/migration.py
@@ -196,9 +196,8 @@ def _pre_migrate_user(ldap, pkey, dn, entry_attrs, failed, config, ctx, **kwargs
         entry_attrs.setdefault('loginshell', default_shell)
 
     # do not migrate all attributes
-    for attr in entry_attrs.keys():
-        if attr in attr_blacklist:
-            del entry_attrs[attr]
+    for attr in attr_blacklist:
+        entry_attrs.pop(attr, None)
 
     # do not migrate all object classes
     if 'objectclass' in entry_attrs:
@@ -393,9 +392,8 @@ def _pre_migrate_group(ldap, pkey, dn, entry_attrs, failed, config, ctx, **kwarg
         raise ValueError('Schema %s not supported' % schema)
 
     # do not migrate all attributes
-    for attr in entry_attrs.keys():
-        if attr in attr_blacklist:
-            del entry_attrs[attr]
+    for attr in attr_blacklist:
+        entry_attrs.pop(attr, None)
 
     # do not migrate all object classes
     if 'objectclass' in entry_attrs:
-- 
2.1.0

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

Reply via email to