From feedback@checkmk.com Tue May 23 09:32:48 2023 From: External contributor To: checkmk-werks-lvl1@lists.checkmk.com Subject: Checkmk Werk 15493: Adjustments to local extensions may be required Date: Tue, 23 May 2023 11:32:47 +0200 Message-ID: <1684834367.015419.2547588.nullmailer@review.lan.tribe29.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0342609506686757169==" --===============0342609506686757169== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable ID: 15493 Title: Adjustments to local extensions may be required Component: Multisite Level: 2 Class: New feature Version: 2.2.0 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, b= ut 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 modu= le 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.chec= k_mk". Check your plugin to see what is imported from there, e.g. "df_translation" a= nd add the import: F+:metrics/my_custom_file from cmk.gui.plugins.metrics.translation import df_translation F-: 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: F+:views/my_custom_file from cmk.gui.views.inventory.registry import inventory_displayhints F-: 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 n= ew place is to grep for it in '~/lib/python3/cmk/gui' and adjust the import in bar: F+:wato/my_custom_file from cmk.gui.plugins.wato.active_checks.common import RulespecGroupIntegrateO= therServices F-: 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: F+:wato/my_custom_file import socket F-: 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-rel= ated API cleanups --===============0342609506686757169==--