Univention Bugzilla – Bug 53430
failed.ldif replication mode broken
Last modified: 2024-02-23 13:42:47 CET
failed.ldif replication mode broken Due to two encoding errors only an empty failed.ldif is written if the local ldap server is down. The existing testcase 10_ldap/60failedldif only checks for the existence of the file not that it has been correctly applied after the local ldap server is running again. (And apparently I made the same mistake during product testing...?) Additional to fixing this, I suggest we make it easier/faster to enter the failed.ldif replication mode for better testing. -------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/univention-directory-listener/system/replication.py", line 951, in handler handler(dn, new, listener_old, operation) File "/usr/lib/univention-directory-listener/system/replication.py", line 923, in handler _modify_object_from_old_and_new(lo, dn, old, new) File "/usr/lib/univention-directory-listener/system/replication.py", line 747, in _modify_object_from_old_and_new lo.modify_s(dn, ml) File "/usr/lib/univention-directory-listener/system/replication.py", line 506, in modify_s self.__new_entry(dn) File "/usr/lib/univention-directory-listener/system/replication.py", line 485, in __new_entry self.__print_attribute('dn', dn.encode('UTF-8')) File "/usr/lib/univention-directory-listener/system/replication.py", line 463, in __print_attribute newval = newval.encode('ascii') AttributeError: 'bytes' object has no attribute 'encode' -------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/univention-directory-listener/system/replication.py", line 923, in handler _modify_object_from_old_and_new(lo, dn, old, new) File "/usr/lib/univention-directory-listener/system/replication.py", line 747, in _modify_object_from_old_and_new lo.modify_s(dn, ml) File "/usr/lib/univention-directory-listener/system/replication.py", line 506, in modify_s self.__new_entry(dn) File "/usr/lib/univention-directory-listener/system/replication.py", line 485, in __new_entry self.__print_attribute('dn', dn.encode('UTF-8')) File "/usr/lib/univention-directory-listener/system/replication.py", line 480, in __print_attribute print(value[0:60 - pos], file=self.fp) TypeError: a bytes-like object is required, not 'str'
A testcase and first draft can be found on branch: juern/53430_fix_ldif_replication
(In reply to Jürn Brodersen from comment #1) > A testcase and first draft can be found on branch: > > juern/53430_fix_ldif_replication LGTM
Also happened in Jenkins: https://jenkins.knut.univention.de:8181/job/UCS-5.0/job/UCS-5.0-0/view/Default/job/AutotestJoin/lastCompletedBuild/SambaVersion=s4,Systemrolle=slave/testReport/99_end/01_var_log_tracebacks/slave095/
Applied Jürns patches with small adjustments. I also tested the re applying of an users/user object with a binary jpegPhoto - this works as well. I could not adjust the test case to do this as well as the listener seems to only write a failed.ldif with the temporary objects in that case (hmm~). univention-directory-replication.yaml 94b30c98bd36 | YAML Bug #53430 univention-directory-replication (13.0.2-2) 94b30c98bd36 | YAML Bug #53430 ee8e89cc7e21 | Bug #53430: Make ldap reconnect tries configurable 957f7b806dad | Bug #53430: Fix TypeError during ldif mode ddae881ca8aa | Bug #53430: Fix AttributeError during ldif mode ucs-test (10.0.5-25) a4528b58e5c8 | fixup! Bug #53430: Test restoration of ldif file e8a3c8357a17 | Bug #53430: Speedup 10_ldap/60failedldif test ba3952e4c2fd | Bug #53430: Test restoration of ldif file
Verified: * Code review * Test works (fails before update, works after) * Advisory
<https://errata.software-univention.de/#/?erratum=5.0x20>