summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorAna Krivokapic <akrivoka@redhat.com>2013-09-23 13:56:14 +0200
committerMartin Kosek <mkosek@redhat.com>2013-11-15 12:46:07 +0100
commit6c9b3b02a4578f9985b343e4d6f716a7b829b8f0 (patch)
tree403355ed5c8bd8bcb07adcaf55fc6fcaf486266f /ipalib
parent0ac63976324f93a9bba1b898c81ab740611f7fe5 (diff)
downloadfreeipa.git-6c9b3b02a4578f9985b343e4d6f716a7b829b8f0.tar.gz
freeipa.git-6c9b3b02a4578f9985b343e4d6f716a7b829b8f0.tar.xz
freeipa.git-6c9b3b02a4578f9985b343e4d6f716a7b829b8f0.zip
Fix error message when adding duplicate automember rule
Also fix object_name and object_name_plural for automember rules. https://fedorahosted.org/freeipa/ticket/2708
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/plugins/automember.py4
-rw-r--r--ipalib/plugins/baseldap.py5
2 files changed, 5 insertions, 4 deletions
diff --git a/ipalib/plugins/automember.py b/ipalib/plugins/automember.py
index fc696cc6..71f9a832 100644
--- a/ipalib/plugins/automember.py
+++ b/ipalib/plugins/automember.py
@@ -172,8 +172,8 @@ class automember(LDAPObject):
container_dn = api.env.container_automember
- object_name = 'auto_member_rule'
- object_name_plural = 'auto_member_rules'
+ object_name = 'Automember rule'
+ object_name_plural = 'Automember rules'
object_class = ['top', 'automemberregexrule']
default_attributes = [
'automemberinclusiveregex', 'automemberexclusiveregex',
diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py
index 503696ef..eab8d74e 100644
--- a/ipalib/plugins/baseldap.py
+++ b/ipalib/plugins/baseldap.py
@@ -582,9 +582,10 @@ class LDAPObject(Object):
)
def handle_duplicate_entry(self, *keys):
- pkey = ''
- if self.primary_key:
+ try:
pkey = keys[-1]
+ except KeyError:
+ pkey = ''
raise errors.DuplicateEntry(
message=self.already_exists_msg % {
'pkey': pkey, 'oname': self.object_name,