Skip to content

Commit

Permalink
vue: use DEFAULT_VALUE sentinel when creating new rule
Browse files Browse the repository at this point in the history
Change-Id: I19b521d2299d91df8639b4f0741a757da4e236c4
  • Loading branch information
schnetzzz committed Jan 15, 2025
1 parent eb0502e commit 8dee1f8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmk/gui/wato/pages/rulesets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(),
Expand Down

0 comments on commit 8dee1f8

Please sign in to comment.