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

Added errorhandling to lookup API #475

Merged
merged 7 commits into from
Dec 1, 2023

Conversation

Max-checkmk
Copy link
Contributor

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

  • If there's an error when calling the url, the error is passed uncontrolled to the user

What is the new behavior?

  • Errors when calling the endpoint will be catched in the lookup_api and returned to the lookup-modules for output

Other information

I'm sure there's a nicer way to do this. So any improvements appreciated.
Main problem is that ansible doesn't allow using the ansible.errors library in the api folder, just inside the modules.

@Max-checkmk Max-checkmk added enhancement New feature or request lookup:version This affects the lookup module 'version'. lookup:folder This affects the lookup module 'folder'. lookup:folders This affects the lookup module 'folders'. lookup:host This affects the lookup module 'host'. lookup:hosts This affects the lookup module 'hosts'. labels Nov 13, 2023
@Max-checkmk Max-checkmk self-assigned this Nov 13, 2023
@github-actions github-actions bot removed lookup:version This affects the lookup module 'version'. lookup:folder This affects the lookup module 'folder'. lookup:folders This affects the lookup module 'folders'. lookup:host This affects the lookup module 'host'. lookup:hosts This affects the lookup module 'hosts'. labels Nov 13, 2023
Copy link
Contributor

@lgetwan lgetwan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate a lot to have a logging mechanism! :-D
Only minor change requests below...

plugins/lookup/folder.py Outdated Show resolved Hide resolved
plugins/module_utils/lookup_api.py Outdated Show resolved Hide resolved
plugins/module_utils/lookup_api.py Outdated Show resolved Hide resolved
Copy link
Contributor

@lgetwan lgetwan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks perfect, now!

@robin-checkmk robin-checkmk mentioned this pull request Nov 22, 2023
7 tasks
@robin-checkmk robin-checkmk changed the base branch from devel to hackathon/2023-12-01 December 1, 2023 10:36
@robin-checkmk robin-checkmk mentioned this pull request Dec 1, 2023
7 tasks
@robin-checkmk robin-checkmk merged commit 4e8642a into hackathon/2023-12-01 Dec 1, 2023
8 checks passed
@robin-checkmk robin-checkmk deleted the LookupAPI_AddErrorHandling branch December 1, 2023 12:00
@github-actions github-actions bot locked and limited conversation to collaborators Dec 1, 2023
@robin-checkmk robin-checkmk added the release:4.0.0 Affects the mentioned release. label Dec 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request release:4.0.0 Affects the mentioned release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants