ruby-net-ldap
ruby-net-ldap copied to clipboard
Cant modify - Silent failure
Code:
...
# Find a element
found = (LDAP.search :filter => (Net::LDAP::Filter.eq("cn", "OLDCN"))).first
# Replace its CN
p LDAP.replace_attribute(found.dn, :cn, "NEWCN")
# Search by old CN
p (LDAP.search :filter => (Net::LDAP::Filter.eq("cn", "OLDCN"))).first
# => Found it again
Output:
false
#<Net::LDAP::Entry:0x0000000101fd28 @myhash={:dn=>["CN=OLDCN,...]
There is no error. Nothing was stored apparently. This is either a bug or it should tell me that i am doing something wrong.
I had a similar issue after a call to .add, and found I had to inspect LDAP.get_operation_result to detect errors. If LDAP.get_operation_result.code > 0, there's normally a useful message in LDAP.get_operation_result.message (http://www.rubydoc.info/gems/ruby-net-ldap/Net/LDAP:get_operation_result)