ansible / ansible-rulebook

Apache License 2.0
194 stars 77 forks source link

SOURCE_DIR only applies to source plugins, not filter plugins #571

Open cloin opened 1 year ago

cloin commented 1 year ago

Please confirm the following

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

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 1 year ago

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.

cloin commented 1 month ago

Should I open a new issue with a better description?

Alex-Izquierdo commented 1 month ago

If you agree to treat it as a request feature that looks good to me.