I want to create a python 3.6 version script that will compare 2 LDIF files and generate…
- User
I want to create a python 3.6 version script that will compare 2 LDIF files and generate an LDIF file of the delta to be apply on the 2nd Ldif content to match the 1st pne..
- Assistant
You can use the
ldifmodule from thepython-ldappackage to compare and generate a delta LDIF file. First, install the package usingpip:bashpip install python-ldapNow, create a script for comparing and generating a delta LDIF file:
python - User
create a python script (compatible with 3.6 version and library available) to compare 2 ldif files and generate a ldif file of differences to be applied on the 2nd file to match the 1st file. attributes to compare are: objectclass, cn, sn, lastname, mail , mobile, department number, .. some attributes (like mail or objectclass could have multiples entries) if an entry in the 2nd file is not anymore in the 1st one, the entry should not be deleted but and attribute ds-pwp-account-disabled should be set to TRUE it should support UTF8 caracters
- Assistant
- User
the script should skip empty lines and new ldif block is starting with a dn key
- Assistant
To skip empty lines and only start a new LDIF block with a "dn" key, you can modify the LDIF parsing function to check for these conditions. Here's the updated script: