summaryrefslogtreecommitdiffstats
path: root/ipalib/plugins/dns.py
diff options
context:
space:
mode:
authorMartin Kosek <mkosek@redhat.com>2012-02-21 10:37:08 +0100
committerMartin Kosek <mkosek@redhat.com>2012-02-28 08:45:05 +0100
commitaff6bc0e63377de50ce5dc0e024eb13669728f8f (patch)
tree3516f14208b146fd3e1b264a25237cfb9f70a7cd /ipalib/plugins/dns.py
parentee780df13c99a5465cd6df965772260c297a5eb2 (diff)
downloadfreeipa-aff6bc0e63377de50ce5dc0e024eb13669728f8f.tar.gz
freeipa-aff6bc0e63377de50ce5dc0e024eb13669728f8f.tar.xz
freeipa-aff6bc0e63377de50ce5dc0e024eb13669728f8f.zip
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
Diffstat (limited to 'ipalib/plugins/dns.py')
-rw-r--r--ipalib/plugins/dns.py10
1 files changed, 8 insertions, 2 deletions
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]))