Skip to content

Fix crash when editing rules with hyphenated predefined condition IDs#932

Open
mueller-ma wants to merge 1 commit into
Checkmk:masterfrom
dahag-ag:fix-hyphen-hostname
Open

Fix crash when editing rules with hyphenated predefined condition IDs#932
mueller-ma wants to merge 1 commit into
Checkmk:masterfrom
dahag-ag:fix-hyphen-hostname

Conversation

@mueller-ma

@mueller-ma mueller-ma commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Thank you for your interest in contributing to Checkmk!
Consider looking into Readme regarding process details.

General information

Predefined condition identifiers created in Checkmk 2.4 or earlier could contain hyphens (e.g. 'cond_host_monitoring-01'). The new rule catalog renderer passed these idents directly as SingleChoiceElement names, which requires valid Python identifiers, causing a ValueError when opening or editing any rule that referenced such a condition.

Fix by using SingleChoiceExtended / SingleChoiceElementExtended (internal API) instead of the public SingleChoice / SingleChoiceElement for the predefined conditions list. The Extended variants do not validate names as Python identifiers.

Bug reports

See https://forum.checkmk.com/t/unable-to-edit-rules-when-explicit-hostname-contains-hyphens/59918

Proposed changes

Same fix than in 9d1fe1a
Disclaimer: AI generated and untested.

Predefined condition identifiers created in Checkmk 2.4 or earlier could
contain hyphens (e.g. 'cond_host_monitoring-01'). The new rule catalog
renderer passed these idents directly as SingleChoiceElement names, which
requires valid Python identifiers, causing a ValueError when opening or
editing any rule that referenced such a condition.

Fix by using SingleChoiceExtended / SingleChoiceElementExtended (internal
API) instead of the public SingleChoice / SingleChoiceElement for the
predefined conditions list. The Extended variants do not validate names as
Python identifiers.

Refs: https://forum.checkmk.com/t/unable-to-edit-rules-when-explicit-hostname-contains-hyphens/59918
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant