From 8dee1f88c641dff75c74c3642513fa4334a8bf68 Mon Sep 17 00:00:00 2001 From: Andreas Boesl Date: Wed, 15 Jan 2025 16:33:08 +0100 Subject: [PATCH] vue: use DEFAULT_VALUE sentinel when creating new rule Change-Id: I19b521d2299d91df8639b4f0741a757da4e236c4 --- cmk/gui/wato/pages/rulesets.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmk/gui/wato/pages/rulesets.py b/cmk/gui/wato/pages/rulesets.py index 2fee5a17e2b..0e93372938b 100644 --- a/cmk/gui/wato/pages/rulesets.py +++ b/cmk/gui/wato/pages/rulesets.py @@ -53,7 +53,7 @@ render_form_spec, RenderMode, ) -from cmk.gui.form_specs.vue.visitors import DataOrigin +from cmk.gui.form_specs.vue.visitors import DataOrigin, DEFAULT_VALUE from cmk.gui.hooks import call as call_hooks from cmk.gui.hooks import request_memoize from cmk.gui.htmllib.generator import HTMLWriter @@ -3152,6 +3152,13 @@ def _set_rule(self) -> None: service_description_conditions = [{"$regex": "%s$" % escape_regex_chars(item)}] self._rule = Rule.from_ruleset_defaults(self._folder, self._ruleset) + try: + # If the rulespec already uses the new form spec, use the DEFAULT_VALUE sentinel + # instead of an auto-generated valuespec:default_value() + _tmp = self._ruleset.rulespec.form_spec + self._rule.value = DEFAULT_VALUE + except FormSpecNotImplementedError: + pass self._rule.update_conditions( RuleConditions( host_folder=self._folder.path(),