Bug 50401 - Migrate udm_extension.py of univention-directory-manager-modules to dh_python2
Migrate udm_extension.py of univention-directory-manager-modules to dh_python2
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UDM (Generic)
UCS 4.4
All Linux
: P5 normal (vote)
: UCS 4.4-3-errata
Assigned To: Florian Best
Jürn Brodersen
:
Depends on: 49147
Blocks: 28497
  Show dependency treegraph
 
Reported: 2019-10-22 17:22 CEST by Florian Best
Modified: 2020-01-15 16:59 CET (History)
3 users (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:
best: Patch_Available+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2019-10-22 17:22:41 CEST
The listener/udm_extension.py module writes python symlinks and files to certain pathes using python-support.

This must be migrated and all existing files migrated.

+++ This bug was initially created as a clone of Bug #49147 +++

The package management/univention-directory-manager-modules should be migrated to use dh_python instead of python-support.

Migration-Guide: https://hutten.knut.univention.de/mediawiki/index.php/Python_DebHelper_Migration
Comment 1 Florian Best univentionstaff 2019-10-22 21:34:20 CEST
Consider Bug #49147 comment 1, 2, 3 and 4 when fixing this.
Comment 2 Florian Best univentionstaff 2019-10-23 15:24:46 CEST
WIP branch: git:fbest/50401-udm-listener-dh-python
Comment 3 Florian Best univentionstaff 2019-12-11 10:12:52 CET
Updated the branch, the patch should now work but it requires a:
univention-directory-listener-ctrl resync udm_extension
to let the initialize() function run, which does the migration.
Comment 4 Florian Best univentionstaff 2019-12-18 10:50:53 CET
I accidently commited with the wrong bug number (Bug #49147):

univention-directory-manager-modules (14.0.14-19)
0210701a136d | Bug #49147: add logging to deprecated pathes
ac20bd8fe91c | Bug #49147: migrate listener udm_extension.py to dh-python

QA 1: compare the files between upgrading, ideally with some apps like ucsschool, oxseforucs installed:
Before upgrade:

find /usr/share/pyshared/univention/admin/ /usr/lib/pymodules/python2.7/univention/admin/ /usr/lib/python2.7/dist-packages/univention/admin > admin.pre

After upgrade:
find /usr/share/pyshared/univention/admin/ /usr/lib/pymodules/python2.7/univention/admin/ /usr/lib/python2.7/dist-packages/univention/admin > admin.post
vimdiff admin.pre admin.post

QA 2: test this also with apps (e.g. oxseforucs) which are still installing the python files to the old locations.
QA 3: test this also with apps (e.g. univention-s4-connector) which are still installing the python files already to the new location
QA 4: the registration after the upgrade should still work
Comment 5 Florian Best univentionstaff 2019-12-18 15:51:26 CET
Adjusted the path for the test cases:

ucs-test (9.0.3-130)
127bff120673 | Bug #50401: adjust pyshared pathes
Comment 6 Jürn Brodersen univentionstaff 2019-12-18 16:10:21 CET
Reopen:
In "def initialize", please put the "listener.unsetuid()" into a finally. Also I don't think the handler function needs "listener.setuid(0)", it should handle that by itself. Or does that not work?

Nice to have:
The initialize function would look cleaner if the migration part is moved into a function :)
I would also like a debug message in case a module is migrated and a message after  the migration has completed.

Unsure:
The listener does not create byte compiled files any more. Not really a problem but different to the old behaviour as far as I can tell. A "pycompile $DIR" should  help.

What I tested so far:
Migration works on master, backup, slave and member -> OK

What I still need to test:
Some more apps (ox, s4-connector, office365)
Comment 7 Florian Best univentionstaff 2019-12-18 16:35:38 CET
(In reply to Jürn Brodersen from comment #6)
> Reopen:
> In "def initialize", please put the "listener.unsetuid()" into a finally.
Ok.

> Also I don't think the handler function needs "listener.setuid(0)", it
> should handle that by itself. Or does that not work?
It is necessary, several functions are calling unsetuid().

> Nice to have:
> The initialize function would look cleaner if the migration part is moved
> into a function :)
initialize() only does the migration. Added call to a single function from initialize()…

> I would also like a debug message in case a module is migrated and a message
> after  the migration has completed.
Okay, added as INFO (which is then never printed by default).

> Unsure:
> The listener does not create byte compiled files any more. Not really a
> problem but different to the old behaviour as far as I can tell. A
> "pycompile $DIR" should  help.
Well, I don't think this is necessary and not even used (code is: execfile(open(udm_syntax)). But I added it nevertheless.

univention-directory-manager-modules (14.0.14-21)
bca3b76ad482 | Bug #44135: add pycompiling, etc.
Comment 8 Jürn Brodersen univentionstaff 2020-01-13 11:23:43 CET
Test for the migration:
[4.4-3 417b514989] Bug #50401: 72_udm-extensions/50_test_pysupport_to_dhpython_migration

Tests OK
Apps OK
yaml OK

-> Verified
Comment 9 Erik Damrose univentionstaff 2020-01-14 09:38:39 CET
Reopen:
At least ucs-tests for ucs@school regarding udm extensions failed for some runs

https://jenkins.knut.univention.de:8181/job/UCSschool-4.4/job/Install%20Singleserver/359/testReport/
Comment 10 Erik Damrose univentionstaff 2020-01-14 10:10:32 CET
Back to verified: The schooltests were running with an up-to-date ucs-test, but the erratum developed at this bug has not been released, so the tests failed.
Comment 11 Erik Damrose univentionstaff 2020-01-15 16:59:58 CET
<http://errata.software-univention.de/ucs/4.4/421.html>