Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'event' When assigning events after a match the var_root accesses invalid key #101

Open
mkanoor opened this issue Jul 12, 2022 · 1 comment

Comments

@mkanoor
Copy link
Contributor

mkanoor commented Jul 12, 2022

  • ansible-events version: 0.4.0
  • Python version:3.9.13
  • Operating System: MacOS

Description

Get a Key Error when we making an assignment to events after a match.

Trying to run a playbook after an assignment on an event match

condition: events.third << event.i == 2

Tell us what happened, what went wrong, and what you expected to happen.
E KeyError: 'event'
https://github.com/benthomasson/ansible-events/blob/38ba754fa97b2b188b424ed898ce084985544510/ansible_events/builtin.py#L134

What I Did

Ran a playbook as part of assigning a matched event.

Modified tests/test_simple.yml
changed
condition: event.i == 2
to
condition: events.second << event.i == 2

Ran pytest
pytest tests/test_engine.py::test_run_rules_simple
@benthomasson
Copy link
Contributor

I haven't tried the << operator in a single condition yet. I am not sure if that would work. It should throw a better error if it does not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants