SOURCE_DIR only applies to source plugins, not filter plugins
cloin opened this issue · 3 comments
cloin commented
Please confirm the following
- I agree to follow this project's code of conduct.
- I have checked the current issues for duplicates.
- I understand that ansible-rulebook is open source software provided for free and that I might not receive a timely response.
Bug Summary
When developing filter plugins, passing --source-dir
does not allow for local filter plugins, only local local source plugins. This means that the filter plugin has to be published in a collection to be tested.
Environment
[root@dd6d2c871e07 cloin.eda]# ansible-rulebook --version
__version__ = '1.0.1'
Executable location = /usr/local/bin/ansible-rulebook
Drools_jpy version = 0.3.4
Java home = /usr/lib/jvm/jre-17-openjdk
Java version = 17.0.8
Python version = 3.11.4 (main, Jun 7 2023, 00:00:00) [GCC 13.1.1 20230511 (Red Hat 13.1.1-2)]
Steps to reproduce
- Create a filter plugin and keep it local.
- Specify the filter plugin in a rulebook against an already published event source:
---
- name: Respond to webhook POST
hosts: all
sources:
- ansible.eda.webhook:
host: 0.0.0.0
port: 5000
filters:
- endpoint_as_namespace:
- Run ansible-rulebook
ansible-rulebook -r webhook.yml -i inventory.yml -S ./extensions/eda/plugins/event_filter/ --verbose
Actual results
ansible-rulebook fails because it can't find the filter plugin
2023-08-11 15:17:06,126 - ansible_rulebook.engine - INFO - Cancelling all ruleset tasks
2023-08-11 15:17:06,127 - ansible_rulebook.engine - INFO - Waiting on gather
2023-08-11 15:17:06,127 - ansible_rulebook.engine - INFO - Returning from run_rulesets
2023-08-11 15:17:06,127 - ansible_rulebook.app - INFO - Cancelling event source tasks
2023-08-11 15:17:06,128 - ansible_rulebook.app - ERROR - Could not find source filter plugin for endpoint_as_namespace
2023-08-11 15:17:06,129 - ansible_rulebook.app - INFO - Main complete
2023-08-11 15:17:06,129 - ansible_rulebook.cli - ERROR - Terminating One of the source plugins failed
Expected results
ansible-rulebook finds the filter plugin based on the path in SOURCE_DIR
Additional information
No response
Alex-Izquierdo commented
I would say is not a bug but a feature request. sources
flag indicates clearly that are sources, not filters. Anyway the description could be better.
I guess we could add a new flag for local filters or create a new one "plugins" able to take both types.