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

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

Open
3 tasks done
cloin opened this issue Aug 11, 2023 · 3 comments
Open
3 tasks done

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

cloin opened this issue Aug 11, 2023 · 3 comments

Comments

@cloin
Copy link
Contributor

cloin commented Aug 11, 2023

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
Copy link
Contributor

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
Copy link
Contributor Author

cloin commented Sep 5, 2024

Should I open a new issue with a better description?

@Alex-Izquierdo
Copy link
Contributor

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

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