Open DustinWi opened 2 months ago
@DustinWi The "is not defined" is tricky to use since it can lead to a lot of triggering of rules, when the payload doesn't have the required keys. In ansible-rulebook if a "key" is missing the rule is skipped, it doesn't raise an exception and stop. So what is your use case? Are you trying to guard against the key missing?
@DustinWi Another thing I noticed is
condition: event.meta.headers != "Hello Testing World"
Is that trying to compare a dict with a string. The event.meta.headers is a dictionary of HTTP headers created by ansible.eda.webhook
Please confirm the following
Bug Summary
When trying to check if a 'Token' header is set for a webhook event,
... is not defined
is not triggering. If I change to... is defined
the behavior works as expected.Environment
OS:
Python:
Ansible-Rulebook:
Steps to reproduce
Actual results
The expected rule does not trigger, one of the latter rules triggers.
Expected results
When sending a request with no Token header set, the first rule should trigger.
Additional information
Rulebook:
Test Commands and the resulting events using
--verbose
and--print-events
are below. As you can see, the first command attempts to trigger the first rule. However, the third rule is triggered instead.Command 1:
Result 1:
Command 2:
Result 2:
Command 3:
Result 3:
Command 4:
Result 4:
Command 5:
Result 5: