Rule criteria regex matching against list objects #5363
Unanswered
dylan-bitovi
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
ST2: 3.5
My use case is not so different than this old ticket: #2656
I'm processing Jira ticket webhook data, the
components
field on a ticket returns alist
when called with:trigger.body.issue.fields.components.name
e.g
[ Component, Three Word Component ]
After testing with the
regex
function andst2-rule-tester
there doesn't seem to be a way of checking a list object for multiple items as part of a criteria.I can't use
contains
against the object in the criteria twice as then I cannot register the pack as there is a duplicatekey
in the criteria field which is adictionary
type thus causing an error.e.g
Will fail at
register_pack
during the install process.Using regex seems to partially work as I can register my regex function, but it seems to drop the value and pattern when used against a
list
(tested with st2-rule-tester):e.g:
When I change the above variable to a part of the webhook data that's string or number it behaves normally with no error or otherwise operates as expected.
I tried playing around with
publish
ing variable data higher up in the rule to see if I could get ahead of the criteria in any way, but there didn't seem to be anything that worked.I also attempted to use YAQL/Jinja functions to see if I could apply them directly on the value such as
str()
orjoin(" ")
but they would cause errors at trigger execution time.Writing separate rule files for each wouldn't work as I need the logical
AND
functionality of checking both at once. Validation can be done as part of the workflow, but it would be more ideal if it we could filter it without calling any action.My questions are so:
regex
match functionality allow forlist
andset
types by adding a list to string function in the regex operator if one is detected?Writing a custom sensor to get around an object type seems a bit extreme, but I'm curious if there's something I'm missing.
Not sure if I should submit this as a bug or a feature request :)
Beta Was this translation helpful? Give feedback.
All reactions