CMK version: 2.5.0p8 Pro
OS version: Debian 13
Error message:
Hi,
after upgrading from Checkmk 2.4 to Checkmk 2.5, we can no longer open or edit rules.
The server running checkmk contains a hyphen:
monitoring-01
Opening the rule results in the following exception:
ValueError: 'cond_host_monitoring-01' is not a valid, non-reserved Python identifier
Relevant part of the traceback:
File "/omd/sites/prodnp/lib/python3/cmk/gui/wsgi/applications/checkmk.py", line 247, in _process_request
resp = page_handler(ctx)
File "/omd/sites/prodnp/lib/python3/cmk/gui/wsgi/applications/utils.py", line 140, in _call_auth
handler(ctx)
File "/omd/sites/prodnp/lib/python3/cmk/gui/wato/page_handler.py", line 81, in page_handler
mode_instance = mode_registry.get(current_mode, ModeNotImplemented)()
File "/omd/sites/prodnp/lib/python3/cmk/gui/wato/pages/rulesets.py", line 2085, in __init__
self._form_type = self._init_form_type()
File "/omd/sites/prodnp/lib/python3/cmk/gui/wato/pages/rulesets.py", line 2131, in _init_form_type
create_rule_catalog(
File "/omd/sites/prodnp/lib/python3/cmk/gui/watolib/rulesets.py", line 2467, in create_rule_catalog
**_create_rule_conditions_catalog_topic(
File "/omd/sites/prodnp/lib/python3/cmk/gui/watolib/rulesets.py", line 2405, in _create_rule_conditions_catalog_topic
SingleChoiceElementAPI(name=n, title=Title("%s") % t)
File "<string>", line 5, in __init__
File "/omd/sites/prodnp/lib/python3.13/site-packages/cmk/rulesets/v1/form_specs/_basic.py", line 458, in __post_init__
raise ValueError(f"'{self.name}' is not a valid, non-reserved Python identifier")
'cond_host_monitoring-01' is not a valid, non-reserved Python identifier
It appears that the hostname is used directly to generate the form element name:
cond_host_<hostname>
Since the resulting value contains hyphens, it is not a valid Python identifier.
The hostnames themselves were already present and worked without problems in Checkmk 2.4. Renaming the hosts is not a practical workaround for us.
Has anyone encountered this after upgrading to Checkmk 2.5? Is this already known or fixed in a newer patch release?