Open tarilabs opened 1 year ago
Hi @tarilabs, we just added the generic source plugin to the collection a couple of days ago and we need to get a new release up on Galaxy. I'll see if we can get it done this week.
In the interim, you can clone the event-driven-ansible collection repo and from there run: ansible-galaxy collection install .
You may need to include the --force
arg to overwrite your existing collection.
Hi, there is no need to clone the repo. You can run just
ansible-galaxy collection install git+https://github.com/ansible/event-driven-ansible.git --force
duly noted ✍️ thank you for all your feedbacks. I would suggest keeping this issue open until new EDA release, also for Google/SEO purposes in case someone else stumbles on the same issue.
fyi I have tried per https://github.com/ansible/ansible-rulebook/issues/494#issuecomment-1525142500
but it does not work:
$ ansible-galaxy collection install git+https://github.com/ansible/event-driven-ansible.git --force
Cloning into '/Users/mmortari/.ansible/tmp/ansible-local-4300uq5kaeu1/tmp_fbly964/event-driven-ansiblerqnade2u'...
remote: Enumerating objects: 125, done.
remote: Counting objects: 100% (125/125), done.
remote: Compressing objects: 100% (104/104), done.
remote: Total 125 (delta 6), reused 70 (delta 2), pack-reused 0
Receiving objects: 100% (125/125), 43.73 KiB | 2.08 MiB/s, done.
Resolving deltas: 100% (6/6), done.
Your branch is up to date with 'origin/main'.
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Installing 'ansible.eda:1.3.5' to '/Users/mmortari/.ansible/collections/ansible_collections/ansible/eda'
Created collection for ansible.eda:1.3.5 at /Users/mmortari/.ansible/collections/ansible_collections/ansible/eda
ansible.eda:1.3.5 was installed successfully
$ cat empirico1.rulebook.yml
- name: empirico1
hosts: all
sources:
- ansible.eda.generic:
payload:
- kind: Pod
apiVersion: v1
metadata:
name: hello-pvdf
namespace: default
uid: 6cd445f4-227d-4e81-957f-88ab08ee0a6c
resourceVersion: '35203'
creationTimestamp: '2023-04-26T14:50:54Z'
labels:
app.kubernetes.io/name: hello-pvdf
app.kubernetes.io/version: 1.47-SNAPSHOT
rules:
- name: r1
condition: event.payload.metadata.name == "hello-pvdf"
action:
debug:
msg: "Received: {{ event.payload.metadata.uid }}"
$ ansible-rulebook -i inventory.yml --rulebook empirico1.rulebook.yml
2023-05-02 09:25:48,744 - ansible_rulebook.engine - ERROR - Source error
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/ansible_rulebook/engine.py", line 93, in start_source
raise Exception(
Exception: Could not find source plugin for ansible.eda.generic
2023-05-02 09:25:48,745 - ansible_rulebook.engine - ERROR - Shutting down source: ansible.eda.generic error : Could not find source plugin for ansible.eda.generic
2023-05-02 09:25:48,765 - ansible_rulebook.app - ERROR - Could not find source plugin for ansible.eda.generic
2023-05-02 09:25:48,766 - ansible_rulebook.cli - ERROR - Unexpected exception
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/ansible_rulebook/cli.py", line 196, in main
asyncio.run(app.run(args))
File "/usr/local/Cellar/python@3.10/3.10.11/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/Cellar/python@3.10/3.10.11/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/usr/local/lib/python3.10/site-packages/ansible_rulebook/app.py", line 122, in run
raise Exception("One of the source plugins failed")
Exception: One of the source plugins failed
Hitting same issue as @tarilabs while trying to use the ansible.eda.watchdog
source.
Ansible-rulebook version is 0.13.0
.
Please confirm the following
Bug Summary
This source is mentioned in the doc:
https://github.com/ansible/ansible-rulebook/blob/34d60eb61aa78b41ca2fc20f1174089399896fde/docs/conditions.rst?plain=1#L188-L190
The
generic
source (in my understanding formallyansible.eda.generic
), is not available in the 1.3.3/(galaxy 1.3.4) from EDA:https://github.com/ansible/event-driven-ansible/tree/v1.3.3?search=1
but it's only available from
main
branch: https://github.com/ansible/event-driven-ansible/blob/main/extensions/eda/plugins/event_source/generic.pywhich is NOT yet released.
Hence, a user (like me 😅 ) trying out the example from the documentation fails as described below.
Environment
latests of all collections:
(even if I cannot find it on github 🤔 )
Steps to reproduce
condition: event.request is defined
Actual results
2023-04-27 08:29:42,245 - ansible_rulebook.engine - ERROR - Source error Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/ansible_rulebook/engine.py", line 93, in start_source raise Exception( Exception: Could not find source plugin for generic
Expected results
simple example from doc to be working
Additional information
No response