Skip to content

Commit

Permalink
16123 FIX Use the original message text for rewriting the comment field
Browse files Browse the repository at this point in the history
Werk 16534 made the rewriting of the comment field use the comment field
itself as the basis. For this field, it doesn't really make sense, because
rewriting is the only way to fill that field, so e.g. \0 was always empty.

With this change, we revert to the old behaviour where all match groups
refer to the original message text.

Change-Id: I761db0445b485da62c30656b42bcc65ed30d1151
  • Loading branch information
spt29 committed Sep 17, 2024
1 parent 66522c6 commit 82d301e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions .werks/16123
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Title: Use the original message text for rewriting the comment field
Class: fix
Compatible: compat
Component: ec
Date: 1726062847
Edition: cre
Level: 1
Version: 2.2.0p34

Werk 16534 made the rewriting of the comment field use the comment field
itself as the basis. For this field, it doesn't really make sense, because
rewriting is the only way to fill that field, so e.g. \0 was always empty.

With this change, we revert to the old behaviour where all match groups
refer to the original message text.
2 changes: 1 addition & 1 deletion cmk/ec/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1553,7 +1553,7 @@ def rewrite_event( # pylint: disable=too-many-branches
event["first"] = event["time"]
event["last"] = event["time"]
if "set_comment" in rule:
event["comment"] = replace_groups(rule["set_comment"], event.get("comment", ""), groups)
event["comment"] = replace_groups(rule["set_comment"], event["text"], groups)
if "set_text" in rule:
event["text"] = replace_groups(rule["set_text"], event["text"], groups)
if "set_host" in rule:
Expand Down
2 changes: 1 addition & 1 deletion cmk/gui/mkeventd/wato.py
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,7 @@ def vs_mkeventd_rule(customer: str | None = None) -> Dictionary:
"etc matching group."
)
+ _(
"The placeholder <tt>\\0</tt> will be replaced by the original text of this field. "
"The placeholder <tt>\\0</tt> will be replaced by the original message text. "
"This allows you to add new information at the beginning or at the end."
),
size=64,
Expand Down

0 comments on commit 82d301e

Please sign in to comment.