Bug 51327 - management/univention-self-service: migrate to python3
management/univention-self-service: migrate to python3
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC (Generic)
UCS 4.4
Other Linux
: P5 normal (vote)
: UCS 5.0-1-errata
Assigned To: Maximilian Janßen
Florian Best
: python3-migration
Depends on:
Blocks: 54466
  Show dependency treegraph
 
Reported: 2020-05-19 14:32 CEST by Florian Best
Modified: 2022-02-23 16:29 CET (History)
1 user (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:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2020-05-19 14:32:13 CEST
The UMC module of management/univention-self-service has to be python3-compatible.
Comment 1 Florian Best univentionstaff 2020-07-08 11:03:33 CEST
An API change of the UDM object property type from str → unicode causes this traceback:

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/univention/management/console/base.py", line 359, in __error_handling
    six.reraise(etype, exc, etraceback)
  File "/usr/lib/python2.7/dist-packages/univention/management/console/base.py", line 262, in execute
    function.__func__(self, request, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/univention/management/console/modules/passwordreset/__init__.py", line 102, in _decorator
    return func(self, request, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/univention/management/console/modules/passwordreset/__init__.py", line 179, in _decorated
    return func(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/univention/management/console/modules/decorators.py", line 181, in _response
    return function(self, request)
  File "/usr/lib/python2.7/dist-packages/univention/management/console/modules/decorators.py", line 321, in _response
    result = _multi_response(self, request)
  File "/usr/lib/python2.7/dist-packages/univention/management/console/modules/decorators.py", line 181, in _response
    return function(self, request)
  File "/usr/lib/python2.7/dist-packages/univention/management/console/modules/decorators.py", line 443, in _response
    return list(function(self, iterator, *nones))
  File "/usr/lib/python2.7/dist-packages/univention/management/console/modules/decorators.py", line 289, in _fake_func
    yield function(self, *args)
  File "/usr/lib/python2.7/dist-packages/univention/management/console/modules/passwordreset/__init__.py", line 289, in get_contact
    if self.is_blacklisted(username, 'passwordreset'):
  File "/usr/lib/python2.7/dist-packages/univention/management/console/ldap.py", line 152, in _decorated
    result = func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/univention/management/console/modules/passwordreset/__init__.py", line 1078, in is_blacklisted
    gr_names = map(str.lower, self.dns_to_groupname(groups_dns))
TypeError: descriptor 'lower' requires a 'str' object but received a 'unicode'
Comment 3 Florian Best univentionstaff 2022-01-26 14:50:42 CET
(In reply to Florian Best from comment #1)
> An API change of the UDM object property type from str → unicode causes this
> traceback:
This has already been fixed:
univention-self-service (5.0.0-3)
b8698259b9d1 | Bug #51327: conform to UDM API change

The listener module has already been migrated to Python 3:

univention-self-service (5.0.0-5)
f53b2cd149f1 | Bug #51327: migrate self service listener to Python 3

Leftovers are:

./delete_deregistered_accounts.py
./univention-self-service-invitation
./univention-self-service-request-count
./unittests/test_verify_user.py
./unittests/test_selfservice-blackwhitelists.py
./unittests/conftest.py
./conffiles/self-service-acl.py
./umc/python/passwordreset/tokendb.py
./umc/python/passwordreset/__init__.py
./umc/python/passwordreset/send_plugin.py
./umc/python/passwordreset/sending/send_email.py
./umc/python/passwordreset/sending/send_with_external.py
./umc/python/passwordreset/sending/verify_email.py
./umc/python/passwordreset/sending/__init__.py
./umc/python/passwordreset/sending/send_sms.py
Comment 4 Florian Best univentionstaff 2022-01-26 14:55:56 CET
Please migrate the leftovers to Python 3.
Especially start with the UMC module and test your changes manually.
General notes about Python 3 migration are here:
https://hutten.knut.univention.de/mediawiki/index.php/Python_3_Migration

To execute the module with Python 3 the steps described in has to be done:
https://hutten.knut.univention.de/mediawiki/index.php/Python_3_Migration#UMC
Comment 6 Maximilian Janßen univentionstaff 2022-02-17 16:30:00 CET
We migrated the Univention-Self-Service and the corresponding Unittests to Python3, while staying Python2 compatible.

The package univention-self-service has been migrated to Python 3. The UMC module will still be executed via Python 2 until UCS 5.0-2 due to possible custom plugins for sending the password recovery tokens. Customers need to provide their custom plugins for Python 3 until then.


univention-unittests (2.0.1-3)
6d8003511cfb | Bug #51327: migrate self-service unittests to Python 3

a01141fa7587 | Bug #51327: migrate self-service to Python 3

univention-self-service (5.0.1-18)
6d8003511cfb | Bug #51327: migrate self-service unittests to Python 3
a01141fa7587 | Bug #51327: migrate self-service to Python 3
Comment 7 Maximilian Janßen univentionstaff 2022-02-17 16:53:36 CET
univention-self-service (5.0.1-18)
887c084829de | fixup! Bug #51327: migrate self-service to Python 3
Comment 8 Florian Best univentionstaff 2022-02-21 11:52:00 CET
OK: Python 3 migration of self-service UMC module
OK: Python 3 migration of scripts
OK: unittests migration
OK: univention-unittests adjustments
OK: ucs-test
OK: reverting of executing self-service with Python 3