From aff6bc0e63377de50ce5dc0e024eb13669728f8f Mon Sep 17 00:00:00 2001 From: Martin Kosek Date: Tue, 21 Feb 2012 10:37:08 +0100 Subject: Improve dns error message Improve AttrValueNotFound exception error message raised in the DNS module when a deleted (modified) attribute value is not found in a record. In order to be consistent with previous DNS module implementation this error message should include an attribute label instead of an attribute name. https://fedorahosted.org/freeipa/ticket/2377 --- ipalib/plugins/dns.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'ipalib') diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py index d72172938..1a75f068e 100644 --- a/ipalib/plugins/dns.py +++ b/ipalib/plugins/dns.py @@ -2107,7 +2107,8 @@ class dnsrecord_mod(LDAPUpdate): old_dnsvalue, new_parts = updated_attrs[attr] if old_dnsvalue not in old_entry.get(attr, []): - raise errors.AttrValueNotFound(attr=attr, + attr_name = unicode(param.label or param.name) + raise errors.AttrValueNotFound(attr=attr_name, value=old_dnsvalue) old_entry[attr].remove(old_dnsvalue) @@ -2253,7 +2254,12 @@ class dnsrecord_del(LDAPUpdate): try: old_entry[attr].remove(val) except (KeyError, ValueError): - raise errors.AttrValueNotFound(attr=attr, + try: + param = self.params[attr] + attr_name = unicode(param.label or param.name) + except: + attr_name = attr + raise errors.AttrValueNotFound(attr=attr_name, value=val) entry_attrs[attr] = list(set(old_entry[attr])) -- cgit