Bug 52640 - Migrate ucs-school-lib to Python 3
Migrate ucs-school-lib to Python 3
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: General
UCS@school 5.0
Other Linux
: P5 normal (vote)
: UCS@school 5.0 v1
Assigned To: Florian Best
Felix Botner
https://git.knut.univention.de/univen...
: interim-1
Depends on:
Blocks: 52578 52609 52633 52638
  Show dependency treegraph
 
Reported: 2021-01-12 15:25 CET by Florian Best
Modified: 2021-11-29 17:20 CET (History)
2 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:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2021-01-12 15:25:13 CET
The package ucs-school-lib needs to be migrated to Python 3.

See: https://hutten.knut.univention.de/mediawiki/index.php/Python_3_Migration
Comment 1 Florian Best univentionstaff 2021-01-12 17:14:07 CET
Especially this library is the basis for every module. We need to make sure Python 3 compatibility is not lost.
Comment 2 Jan Luttermann univentionstaff 2021-05-26 13:15:14 CEST
migration already through ucs5.0 rebasing completed
Comment 5 Florian Best univentionstaff 2021-06-14 16:38:28 CEST
Traceback (most recent call last):
  File "01_password_reset", line 26, in test_umc
    username, userdn = schoolenv.create_user(schoolname)
  File "/usr/lib/python3/dist-packages/univention/testing/ucsschool/ucs_test_school.py", line 932, in create_user
    result = cls(**kwargs).create(self.lo)
  File "/usr/lib/python3/dist-packages/ucsschool/lib/models/base.py", line 608, in create
    self.call_hooks("pre", "create", lo)
  File "/usr/lib/python3/dist-packages/ucsschool/lib/models/base.py", line 562, in call_hooks
    self._call_pyhooks(hook_time, func_name, lo)
  File "/usr/lib/python3/dist-packages/ucsschool/lib/models/base.py", line 517, in _call_pyhooks
    all_hooks = _pyhook_loader.get_hook_objects(lo)
  File "/usr/lib/python3/dist-packages/ucsschool/lib/pyhooks/pyhooks_loader.py", line 209, in get_hook_objects
    for meth_name, meths in iteritems(self._pyhook_obj_cache)
  File "/usr/lib/python3/dist-packages/ucsschool/lib/pyhooks/pyhooks_loader.py", line 209, in <listcomp>
    for meth_name, meths in iteritems(self._pyhook_obj_cache)
  File "/usr/lib/python3/dist-packages/ucsschool/lib/pyhooks/pyhooks_loader.py", line 207, in <listcomp>
    ["{}.{}".format(m.im_class.__name__, m.im_func.func_name) for m in meths],
AttributeError: 'function' object has no attribute 'im_class'
Comment 6 Florian Best univentionstaff 2021-06-14 19:26:12 CEST
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/univention/management/console/base.py", line 344, in __error_handling
    six.reraise(etype, exc, etraceback)
  File "/usr/lib/python3/dist-packages/six.py", line 693, in reraise
    raise value
  File "/usr/lib/python3/dist-packages/univention/management/console/base.py", line 247, in execute
    function.__func__(self, request, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/ucsschool/lib/school_umc_ldap_connection.py", line 153, in wrapper_func
    return func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/ucsschool/lib/school_umc_base.py", line 127, in schools
    schools = School.from_binddn(ldap_user_read)
  File "/usr/lib/python3/dist-packages/ucsschool/lib/models/school.py", line 689, in from_binddn
    cls.logger.debug("All local schools: Showing all OUs which DN %s can read.", lo.binddn)
  File "/usr/lib/python3.7/logging/__init__.py", line 1371, in debug
    self._log(DEBUG, msg, args, **kwargs)
  File "/usr/lib/python3.7/logging/__init__.py", line 1519, in _log
    self.handle(record)
  File "/usr/lib/python3.7/logging/__init__.py", line 1529, in handle
    self.callHandlers(record)
  File "/usr/lib/python3.7/logging/__init__.py", line 1591, in callHandlers
    hdlr.handle(record)
  File "/usr/lib/python3.7/logging/__init__.py", line 905, in handle
    self.emit(record)
  File "/usr/lib/python3.7/logging/handlers.py", line 1234, in emit
    self.flush()
  File "/usr/lib/python3.7/logging/handlers.py", line 1310, in flush
    self.target.handle(record)
  File "/usr/lib/python3.7/logging/__init__.py", line 905, in handle
    self.emit(record)
  File "/usr/lib/python3/dist-packages/ucsschool/lib/models/utils.py", line 272, in emit
    ud.debug(self._udebug_facility, udebug_level, msg)
  File "/usr/lib/python3/dist-packages/univention/debug.py", line 63, in debug
    _debug.debug(category, level, message)
TypeError: argument 3 must be str, not bytes
Comment 8 Florian Best univentionstaff 2021-06-18 16:08:06 CEST
The detection of School-Lib models does not work:

MODULE      ( WARN    ) : UDM object 'cn=…,cn=computers,ou=DEMOSCHOOL,dc=base' does not correspond to a Python class in the UCS school lib.
Comment 9 Florian Best univentionstaff 2021-07-13 16:17:27 CEST
I will overtake this bug.
Comment 10 Florian Best univentionstaff 2021-07-14 07:59:24 CEST
All files of the ucs-school-lib have been migrated to Python 3.

ucs-school-lib (13.0.3)
c3e9e4d154ca | Bug #52640: [ucs-school-lib] migrate to Python 3

changelog-ucsschool-5.0-de.xml
59f0a99b85c9 | Changlog entry
Comment 11 Felix Botner univentionstaff 2021-08-20 12:46:40 CEST
OK - everything is python3
OK - installation

no functional tests here, should be covered by jenkins test and product tests
Comment 12 Jürn Brodersen univentionstaff 2021-11-29 17:20:02 CET
UCS@school 5.0 v1 has been released.

https://docs.software-univention.de/release-notes-ucsschool-5.0v1-de.html

If this error occurs again, please clone this bug.