From db6de886e4dd717e2717e0343316baf6c20a6a1a Mon Sep 17 00:00:00 2001 From: Madhu Kanoor Date: Tue, 26 Sep 2023 13:01:18 -0400 Subject: [PATCH] docs: handle ": " in a condition (#582) https://issues.redhat.com/browse/AAP-14226 --- docs/conditions.rst | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docs/conditions.rst b/docs/conditions.rst index 1f128dda..eda2cef7 100644 --- a/docs/conditions.rst +++ b/docs/conditions.rst @@ -966,3 +966,30 @@ Example: | if an attribute exists before you use it in a condition. The rule engine | will check for the existence and only then compare it. If its missing, the | comparison fails. + + +| **Q:** If a condition string has an embedded colon followed by a space in it how do I escape it? + +| **Ans:** During the rulebook parsing you would see this error message: +| ERROR - Terminating mapping values are not allowed here. +| To resove this eror you would have to quote the whole condition string or use the > or | and +| move the entire condition to a separate line. + +Example: + .. code-block:: yaml + + name: rule1 + condition: 'event.abc == "test: 1"' + + + .. code-block:: yaml + + name: rule1 + condition: > + event.abc == "test: 1" + + .. code-block:: yaml + + name: rule1 + condition: | + event.abc == "test: 1"