Werk #15493: Adjustments to local extensions may be required

Component User interface
Title Adjustments to local extensions may be required
Date May 17, 2023
Level Prominent Change
Class New Feature
Compatibility Incompatible - Manual interaction might be required
Checkmk versions & editions
2.2.0 Checkmk Raw (CRE), Checkmk Enterprise (CEE), Checkmk Cloud (CCE), Checkmk MSP (CME)

In 2.2, we moved a lot of internal UI code and removed implicitly imported names to reduce unclear situations. This helps our internal code structure, but may cause issues for existing extensions which were relying on these moved or removed names.

It is important to note that such code restructuring is part of the continuous improvement and evolution of Checkmk. These changes can lead to more efficient workflows, improved features, and better performance.

For 2.2 we tried to keep compatibility for the most extensions but could not make sure to cover them all.

Therefore, we would like to give you a few examples, how to adjust local extensions if you see incompatibilities with Checkmk 2.2.
Please note: Each example stands for one possible import problem, so the module names are interchangeable.

Loading "metrics/my_custom_file" failed: No module named 'cmk.gui.plugins.metrics.check_mk'

There is an import from the not existing module "cmk.gui.plugins.metrics.check_mk". Check your plugin to see what is imported from there, e.g. "df_translation" and add the import:

metrics/my_custom_file

from cmk.gui.plugins.metrics.translation import df_translation

Loading "views/my_custom_file" failed: name 'inventory_displayhints' is not defined

In earlier versions, an explicit import was not needed, with 2.2 you have to add:

views/my_custom_file

from cmk.gui.views.inventory.registry import inventory_displayhints

Loading "wato/my_custom_file" failed: cannot import name 'RulespecGroupIntegrateOtherServices' from 'cmk.gui.plugins.wato.active_checks'

The location of some modules may have changed. The simplest way to find the new place is to grep for it in '~/lib/python3/cmk/gui' and adjust the import in 'my_custom_file':

wato/my_custom_file

from cmk.gui.plugins.wato.active_checks.common import RulespecGroupIntegrateOtherServices

Loading "wato/my_custom_file" failed: name 'socket' is not defined

System modules like 'socket' have to be imported from 2.2 on, so please add:

wato/my_custom_file

import socket

For Checkmk 2.3 we plan to introduce a fully described API to avoid such adjustments with every major release in the future.

Also see related werks:

Werk #13094: Various ValueSpec-related API cleanups

To the list of all Werks