When a customer wants to adapt the Kelvin plugin to its needs (like in bug 54307), importing of the Kelvin plugin fails, because the Plugin registration happens on the module level and the module is executed multiple times by the import code: --------------------------------------------------------------------- 2022-01-11 18:09:14 ERROR [IDConnectorService.runner:498] Plugin already registered: kelvin=<plugins.plugins.kelvin_handlers.KelvinHandler object at 0x7f9c23786b80> Traceback (most recent call last): ... File "/var/lib/univention-appcenter/apps/ucsschool-id-connector/conf/plugins/plugins/bb-kelvin.py", line 3, in <module> from plugins.plugins.kelvin_handlers import KelvinHandler File "/ucsschool-id-connector/src/plugins/plugins/kelvin_handlers.py", line 90, in <module> plugin_manager.register(KelvinHandler(), KelvinHandler.plugin_name) --------------------------------------------------------------------- Wrap the plugin registration in try-except, so that other plugins can load the module.
The repeated import of the Kelvin plugin is now possible: [master] 9b9cae0 Bug #54325: allow other plugins to import from the Kelvin plugin module Unrelated formatting fixes: [master] 57bac08 Bug #54325: fix code formatting To test, install the following file at /var/lib/univention-appcenter/apps/ucsschool-id-connector/conf/plugins/plugins and "/etc/init.d/ucsschool-id-connector restart": ----------------------------------------------------------------------------- from plugins.plugins.kelvin_handlers import KelvinHandler from ucsschool_id_connector.plugins import plugin_manager class bbKelvinHandler(KelvinHandler): plugin_name = "bb-kelvin" plugin_manager.register(bbKelvinHandler(), bbKelvinHandler.plugin_name) ----------------------------------------------------------------------------- It will fail with the old version and succeed with the new one. A new Docker image for version 2.2.0 has been built (image hash: dba834d88edd).
QA OK code OK changelogs OK manual test (in 4.4/5.0 envs) before fix raise ValueError( ValueError: Plugin already registered: kelvin=<plugins.plugins.kelvin_handlers.KelvinHandler o bject at 0x7f1c12e6a940> after fix -> no errors
Has been released with v2.2.0 (2021-01-04).