mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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
This commit is contained in:
@@ -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]))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user