Bug 53430 - failed.ldif replication mode broken
failed.ldif replication mode broken
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: Listener (univention-directory-listener)
UCS 5.0
Other Linux
: P5 normal (vote)
: UCS 5.0-0-errata
Assigned To: Florian Best
Arvid Requate
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2021-06-10 15:21 CEST by Jürn Brodersen
Modified: 2024-02-23 13:42 CET (History)
3 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 7: Crash: Bug causes crash or data loss
Who will be affected by this bug?: 4: Will affect most installed domains
How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.320
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): Regression
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jürn Brodersen univentionstaff 2021-06-10 15:21:57 CEST
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'
Comment 1 Jürn Brodersen univentionstaff 2021-06-10 15:26:09 CEST
A testcase and first draft can be found on branch:

juern/53430_fix_ldif_replication
Comment 3 Florian Best univentionstaff 2021-06-14 17:15:44 CEST
(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
Comment 5 Florian Best univentionstaff 2021-06-16 10:30:44 CEST
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
Comment 6 Arvid Requate univentionstaff 2021-06-17 12:51:06 CEST
Verified:
* Code review
* Test works (fails before update, works after)
* Advisory
Comment 7 Erik Damrose univentionstaff 2021-06-23 15:55:46 CEST
<https://errata.software-univention.de/#/?erratum=5.0x20>