script to (re)build extended dns

Matthieu Patou mat+Informatique.Samba at matws.net
Wed Aug 12 01:38:09 MDT 2009


Now using namingContexts instead of more complicated @PARTITIONS



On 08/11/2009 10:21 PM, Matthieu Patou wrote:
> Hello jelmer, andrew,
>
> Following our talks on internet I tried to do what both of you advised me.
>
> So I replaced in my script the two seperated ldb calls to modify the
> attribute into only one, and instead of doing delete/add I do just a
> modify.
>
> At the begining I tried with the wrappers like this:
>
>
> m = ldb.Message()
> m.dn = ldb.Dn(sam_ldb, str(dn))
> m[att] = ldb.MessageElement(saveatt, ldb.CHANGETYPE_MODIFY, att)
> sam_ldb.modify(m)
>
> But it fails I got this message from my script
>
>
> ./rebuildextendeddn.py --targetdir /home/mat/eurocopter/testup/
> --modifymodules
> /home/mat/eurocopter/testup/
> Modifying @MODULES to add extended modules
> DC=smb4,DC=tst
> CN=Domain Guests,CN=Users,DC=smb4,DC=tst has no attr objectCategory
> CN=Group,CN=Schema,CN=Configuration,DC=smb4,DC=tst
> CN=Print Operators,CN=Builtin,DC=smb4,DC=tst has no attr objectCategory
> CN=Group,CN=Schema,CN=Configuration,DC=smb4,DC=tst
> commit called but no ldb transactions are active!commit called but no
> ldb transactions are active!Traceback (most recent call last):
> File "./rebuildextendeddn.py", line 206, in <module>
> rebuild_en_dn(creds,session,paths)
> File "./rebuildextendeddn.py", line 195, in rebuild_en_dn
> sam_ldb.transaction_cancel()
> _ldb.LdbError: (1, None)
>
> Which means that he wasn't able to readd the attribute,removing the test
> leads to database corruption (I tried :-)) so this way do not seems a
> good solution.
>
> Using modify_ldif at the opposite works great.
>
> See my modified version attached and let me know !
>
>
> Cheers.
> Matthieu.
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: rebuildextendeddn.py
Type: text/x-python
Size: 6576 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20090812/543d7119/attachment.py>


More information about the samba-technical mailing list