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

feat: add raise_error and log_error option to insert_hosts_to_meta filter #197

Merged
merged 1 commit into from
Feb 26, 2024

Conversation

bzwei
Copy link
Collaborator

@bzwei bzwei commented Feb 16, 2024

@bzwei bzwei force-pushed the host_exception branch 2 times, most recently from 896d3dc to 8fe04ae Compare February 16, 2024 17:07
@bzwei bzwei force-pushed the host_exception branch 2 times, most recently from 656a019 to 5bfb11c Compare February 16, 2024 17:28
Alex-Izquierdo
Alex-Izquierdo previously approved these changes Feb 16, 2024
@bzwei bzwei force-pushed the host_exception branch 4 times, most recently from ac59ba3 to 2dc84e1 Compare February 16, 2024 20:00
Alex-Izquierdo
Alex-Izquierdo previously approved these changes Feb 19, 2024
@mkanoor
Copy link
Contributor

mkanoor commented Feb 19, 2024

@bzwei should we add documentation here too https://ansible.readthedocs.io/projects/rulebook/en/latest/filters.html

@bzwei
Copy link
Collaborator Author

bzwei commented Feb 19, 2024

@bzwei should we add documentation here too https://ansible.readthedocs.io/projects/rulebook/en/latest/filters.html

Yes.

@Alex-Izquierdo
Copy link
Contributor

I'm concerned about mixing scopes of the documentation. Why not create a docs/event_filter/insert_docs_to_meta.md which was the plan from the beginning and we can continue writing documentation for the rest of things?

Alex-Izquierdo
Alex-Izquierdo previously approved these changes Feb 19, 2024
@mkanoor
Copy link
Contributor

mkanoor commented Feb 20, 2024

@bzwei
With this PR changes and the issue that we had seen with the broken path

 host_path: event.payload.meta.hosts

Nothing changes, there is no log messages and there is no exception. A customer has to be told to use the new raise_exceptions option to see anything meaningful. We are back to square one. This PR doesn't help the customer self diagnose the issue. They might go back to using the limit approach.

We need to log.error by default so out of the box we see an error in the Activation log that the customer can be told to turn off by modifying the rulebook which is an easier change for them.

Maybe log_errors: True|False. True by default.

If they feel there is too much noise they could just set the log_errors: False

@bzwei bzwei force-pushed the host_exception branch 3 times, most recently from 42204ff to 5381251 Compare February 20, 2024 22:48
Alex-Izquierdo
Alex-Izquierdo previously approved these changes Feb 21, 2024
@Alex-Izquierdo
Copy link
Contributor

Hi @bzwei Ruff is failing with:

extensions/eda/plugins/event_filter/insert_hosts_to_meta.py:52:5: PLR0913 Too many arguments to function call (6 > 5)
extensions/eda/plugins/event_filter/insert_hosts_to_meta.py:71:13: TRY400 Use `logging.exception` instead of `logging.error`

CI criteria for eda collections is a pending discussion.

In the case of PLR0913 you already have a exception but I think it must be in line #52. Anyway, since filters receives the plain args and generally speaking, I think it is perfectly reasonable to add the exception for PLR0913 in general in https://github.com/ansible/event-driven-ansible/blob/main/tox.ini#L18

In the case of TRY400 I think we want to keep the check but this case justifies a line exception.

Alex-Izquierdo
Alex-Izquierdo previously approved these changes Feb 21, 2024
Alex-Izquierdo
Alex-Izquierdo previously approved these changes Feb 21, 2024
@mkanoor mkanoor changed the title feat: add raise_exception option to insert_hosts_to_meta filter feat: add raise_exception and log_errors option to insert_hosts_to_meta filter Feb 22, 2024
@mkanoor mkanoor changed the title feat: add raise_exception and log_errors option to insert_hosts_to_meta filter feat: add raise_error and log_error option to insert_hosts_to_meta filter Feb 22, 2024
@Alex-Izquierdo Alex-Izquierdo merged commit 7d84d9c into ansible:main Feb 26, 2024
7 checks passed
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.

3 participants