From b9c3eb79a953fc20e148d518babf84925524f712 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Tue, 20 Mar 2012 22:37:27 -0400 Subject: Fix attributes that contain DNs when migrating. Some attributes, like secretary and manager, may point to other LDAP entries. We need to fix these during migration. https://fedorahosted.org/freeipa/ticket/2562 --- ipalib/plugins/baseldap.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'ipalib/plugins/baseldap.py') diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py index 6b629dc2..a09e00fe 100644 --- a/ipalib/plugins/baseldap.py +++ b/ipalib/plugins/baseldap.py @@ -487,7 +487,15 @@ class LDAPObject(Object): pass # DN object assures we're returning a decoded (unescaped) value dn = DN(dn) - return dn[self.primary_key.name] + try: + return dn[self.primary_key.name] + except KeyError: + # The primary key is not in the DN. + # This shouldn't happen, but we don't want a "show" command to + # crash. + # Just return the entire DN, it's all we have if the entry + # doesn't exist + return unicode(dn) def get_ancestor_primary_keys(self): if self.parent_object: -- cgit