Univention Bugzilla – Bug 55752
Python-2-code tries to import code only available with Python 3
Last modified: 2023-03-02 17:23:42 CET
UDL and `sdnotify` are Python-3-only, but UMC respective "univention.lib.ldap_extension" is executed in Python-2-context and tries to import it during USS: Vorbereitung zum Entpacken von .../052-univention-management-console-module-apps_9.0.7-2A~5.0.0.202302061623_all.deb ... Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/dist-packages/univention/management/console/modules/__init__.py", line 39, in <module> import univention.management.console.protocol # noqa: F401 File "/usr/lib/python2.7/dist-packages/univention/management/console/protocol/__init__.py", line 216, in <module> from .modserver import * # noqa: F403,F401 File "/usr/lib/python2.7/dist-packages/univention/management/console/protocol/modserver.py", line 58, in <module> from .server import Server File "/usr/lib/python2.7/dist-packages/univention/management/console/protocol/server.py", line 54, in <module> from sdnotify import SystemdNotifier ImportError: No module named sdnotify ... univention-management-console-module-appcenter (9.0.7-2A~5.0.0.202302061623) wird eingerichtet ... Setting umc/web/cache_bust File: /var/www/univention/meta.json Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/lib/python2.7/dist-packages/univention/appcenter/actions/__init__.py", line 261, in get_action _import() File "/usr/lib/python2.7/dist-packages/univention/appcenter/actions/__init__.py", line 279, in _import __import__('univention.appcenter.actions.%s' % pymodule_name) File "/usr/lib/python2.7/dist-packages/univention/appcenter/actions/install.py", line 41, in <module> from univention.appcenter.actions.install_base import InstallRemoveUpgrade File "/usr/lib/python2.7/dist-packages/univention/appcenter/actions/install_base.py", line 51, in <module> from univention.appcenter.actions.register import Register File "/usr/lib/python2.7/dist-packages/univention/appcenter/actions/register.py", line 66, in <module> from univention.lib.ldap_extension import UniventionLDAPSchema, get_handler_message File "/usr/lib/python2.7/dist-packages/univention/lib/ldap_extension.py", line 65, in <module> import listener ImportError: No module named listener So far no bad consequences.
The bad consequence is that we break our "promise" to support Python 2 UMC modules (and maybe more). They cannot be imported anymore due to missing "sdnotify".
(In reply to Philipp Hahn from comment #0) > UDL and `sdnotify` are Python-3-only, but UMC respective > "univention.lib.ldap_extension" is executed in Python-2-context and tries to > import it during USS: > > Vorbereitung zum Entpacken von > .../052-univention-management-console-module-apps_9.0.7-2A~5.0.0. > 202302061623_all.deb ... > Traceback (most recent call last): > ImportError: No module named sdnotify → The dependency is available for Python2. Add it in https://git.knut.univention.de/univention/ucs/-/merge_requests/681 > ... > univention-management-console-module-appcenter (9.0.7-2A~5.0.0.202302061623) > wird eingerichtet ... > Setting umc/web/cache_bust > File: /var/www/univention/meta.json > Traceback (most recent call last): > ImportError: No module named listener This is: management/univention-appcenter/debian/univention-management-console-module-appcenter.postinst > 38 if [ -z "$2" ]; then > 39 › # new installation. update local files once as there might be > 40 › # meta files already in the cache that did not undergo > 41 › # _update_local_files routine > 42 › # See Bug#46813 > 43 › python -c "from univention.appcenter.actions import get_action; get_action('update')()._update_local_files()" > 44 fi It seems parts of the App-Center Python 2 support is already broken in UCS 5.0-2 git:01d1f57fa5eb7053b66d16524e7f757f48df0e12. Or specifically "import univention.lib.ldap_extension" does not work anymore with Python 2.7. We didn't detect this, we also had no feedback from any customers. Maybe we can drop our promise to have Python2 support for the App-Center until UCS 5.1 then. The specific Python 2 call in the postinst will be changed to Python 3 in Bug #55632.
Added dependency on python-sdnotify: python -c 'import univention.management.console.protocol.server' works again. univention-management-console.yaml 5719d731d5ea | fix(umc): add missing Python 2.7 dependency univention-management-console (12.0.17-6) 5719d731d5ea | fix(umc): add missing Python 2.7 dependency
Package: univention-management-console Version: 12.0.17-6A~5.0.0.202302241559 Branch: ucs_5.0-0 Scope: errata5.0-3 OK: python2 -c 'import univention.management.console.protocol' IGN: python2 -c 'from univention.lib.ldap_extension import UniventionLDAPSchema'
<https://errata.software-univention.de/#/?erratum=5.0x595>