summaryrefslogtreecommitdiffstats
path: root/ipalib/plugins/baseldap.py
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2012-03-20 22:37:27 -0400
committerMartin Kosek <mkosek@redhat.com>2012-03-22 21:46:27 +0100
commitb9c3eb79a953fc20e148d518babf84925524f712 (patch)
treea45d730729b58ea0e94f5fa0688690cdc3b09c76 /ipalib/plugins/baseldap.py
parent5b8e1e8c62bb899145e3572dc8bfa7cb0570fd05 (diff)
downloadfreeipa-b9c3eb79a953fc20e148d518babf84925524f712.tar.gz
freeipa-b9c3eb79a953fc20e148d518babf84925524f712.tar.xz
freeipa-b9c3eb79a953fc20e148d518babf84925524f712.zip
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
Diffstat (limited to 'ipalib/plugins/baseldap.py')
-rw-r--r--ipalib/plugins/baseldap.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py
index 6b629dc24..a09e00fef 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: