ldb python bindings

Matthieu Patou mat+Informatique.Samba at matws.net
Mon Sep 7 15:35:27 MDT 2009


Andrew, Jelmer,


Here is the error I have when I try to use ldb.CHANGETYPE_MODIFY


Traceback (most recent call last):
   File "/usr/local/src/samba4/source4/scripting/bin/rebuildextendeddn", 
line 172, in <module>
     modify_modules(creds,session,paths)
   File "/usr/local/src/samba4/source4/scripting/bin/rebuildextendeddn", 
line 117, in modify_modules
     sam_ldb.modify(m)
_ldb.LdbError: (16, 'No matching attribute value when deleting 
attribute: @LIST on @MODULES')
A transaction is still active in ldb context [0xa0f8828]

Here is the extract of code:

                 m = ldb.Message()
                 m.dn = ldb.Dn(sam_ldb, "@MODULES")
                 m["@LIST"] = ldb.MessageElement([strmodules], 
ldb.CHANGETYPE_MODIFY, "@LIST")
                 sam_ldb.modify(m)
                 sam_ldb.transaction_commit()


But doing like this works:

                 m = ldb.Message()
                 m.dn = ldb.Dn(sam_ldb, "@MODULES")
                 m["@LIST"] = ldb.MessageElement([], 
ldb.CHANGETYPE_DELETE, "@LIST")
                 sam_ldb.modify(m)
                 m = ldb.Message()
                 m.dn = ldb.Dn(sam_ldb, "@MODULES")
                 m["@LIST"] = ldb.MessageElement([strmodules], 
ldb.CHANGETYPE_AD
                 sam_ldb.modify(m)


But Andrew B do not like it and he prefer to use a 1 time modification. 
Please note that doing it directly in ldif is OK (using replace) but 
Andrew B also do not appriciate this form ...

Matthieu.


More information about the samba-technical mailing list