Skip to content

feat: support local filter testing using -F #822

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mkanoor
Copy link
Contributor

@mkanoor mkanoor commented Jul 25, 2025

When developing new filters a user might want to test the filter, they can put their filters in a directory and pass the directory name using -F.
In the rulebook the filter name should only contain the name of file. e.g if the file name is my_filter.py then when using the filter in the rulebook use my_filter

---
- name: local filter development
  hosts: localhost
  sources:
    - ansible.eda.generic:
        payload:
          - name: Fred
            age: 50
            employed: True
          - name: Barney
            age: 50
            employed: True
      filters:
        - my_filter:
  rules:
    - name: r1
      condition: event.name == "Fred" and event.age == 50
      action:
        debug:

https://issues.redhat.com/browse/AAPRFE-770

@mkanoor mkanoor force-pushed the allow_for_local_filter_dir branch from 61ac13e to 7413fbd Compare July 25, 2025 21:00
When developing new filters a user might want to test the filter,
they can put their filters in a directory and pass the directory name
using -F.
In the rulebook the filter name should only contain the name of file.
e.g if the file name is my_filter.py then when using the filter in the
rulebook use **my_filter**

```
---
- name: local filter development
  hosts: localhost
  sources:
    - ansible.eda.generic:
        payload:
          - name: Fred
            age: 50
            employed: True
          - name: Barney
            age: 50
            employed: True
      filters:
        - my_filter:
  rules:
    - name: r1
      condition: event.name == "Fred" and event.age == 50
      action:
        debug:
```
https://issues.redhat.com/browse/AAPRFE-770
https://issues.redhat.com/browse/AAP-50392
@mkanoor mkanoor force-pushed the allow_for_local_filter_dir branch from 7413fbd to 63f1800 Compare July 25, 2025 21:19
Copy link

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

Successfully merging this pull request may close these issues.

2 participants