diff --git a/.werks/20201.md b/.werks/20201.md new file mode 100644 index 00000000000..01df6cfa668 --- /dev/null +++ b/.werks/20201.md @@ -0,0 +1,21 @@ +[//]: # (werk v3) +# Fix crash when editing rules with predefined conditions whose ID contains hyphens + +key | value +---------- | --- +date | 2026-07-13T00:00:00+00:00 +version | 3.0.0b1 +class | fix +edition | community +component | wato +level | 1 +compatible | yes + +Previously, opening or editing a rule that referenced a predefined condition whose unique ID +contained a hyphen (e.g. `cond_host_monitoring-01`) caused a crash with the error: + +_ValueError: 'cond_host_monitoring-01' is not a valid, non-reserved Python identifier_ + +This affected predefined conditions created in Checkmk 2.4 or earlier that used hyphens in +their ID. The issue only appeared in the rule editor — the conditions themselves still matched +correctly at runtime. diff --git a/cmk/gui/watolib/rulesets.py b/cmk/gui/watolib/rulesets.py index d935c56f908..8c170835544 100644 --- a/cmk/gui/watolib/rulesets.py +++ b/cmk/gui/watolib/rulesets.py @@ -2452,10 +2452,10 @@ def _create_rule_conditions_catalog_topic( CascadingSingleChoiceElementAPI( name="predefined", title=Title("Predefined conditions"), - parameter_form=SingleChoiceAPI( + parameter_form=SingleChoiceExtendedAPI( title=Title("Predefined condition"), elements=[ - SingleChoiceElementAPI( + SingleChoiceElementExtendedAPI( name=n, title=Title("%(title)s") % {"title": t} ) for n, t in PredefinedConditionStore().choices()