summaryrefslogtreecommitdiffstats
path: root/ipalib/plugins/baseldap.py
diff options
context:
space:
mode:
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 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: