summaryrefslogtreecommitdiffstats
path: root/ipalib/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'ipalib/plugins')
-rw-r--r--ipalib/plugins/baseldap.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py
index 7664928be..58d53fd0d 100644
--- a/ipalib/plugins/baseldap.py
+++ b/ipalib/plugins/baseldap.py
@@ -906,6 +906,16 @@ last, after all sets and adds."""),
)
except errors.NotFound:
self.obj.handle_not_found(*keys)
+
+ # Provide a nice error message when user tries to delete an
+ # attribute that does not exist on the entry (and user is not
+ # adding it)
+ names = set(n.lower() for n in old_entry)
+ del_nonexisting = delattrs - (names | setattrs | addattrs)
+ if del_nonexisting:
+ raise errors.ValidationError(name=del_nonexisting.pop(),
+ error=_('No such attribute on this entry'))
+
for attr in needldapattrs:
entry_attrs[attr] = old_entry.get(attr, [])