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

fix: event as list[AlertDTO] not included in the condition #2966

Merged
merged 2 commits into from
Jan 3, 2025

Conversation

00041275
Copy link
Contributor

@00041275 00041275 commented Jan 2, 2025

close #2974

📑 Description

in one of the conditions of the process_event function there is a flaw in processing event as a list. 2 months ago there was no such problem, but now when I upgraded the version of keep I found that zabbix provider started getting an error. while studying the issue (2 days) I finally understood what was the problem. The point is that in one of the conditions there is an attempt to convert dict into some formatted model, but the check condition checks list as well, without even trying to understand what is inside. The base_provider function requires implementing _format_alert, where event=dict. This means that you cannot pass list, or even list[alertDTO]. The change ensures that the _format_alert call is excluded if it is not dict.

base_provider

@staticmethod
    def _format_alert(
        event: dict | list[dict], provider_instance: "BaseProvider" = None
    ) -> AlertDto | list[AlertDto]:

✅ Checks

  • [х] All the tests have passed

Copy link

vercel bot commented Jan 2, 2025

@00041275 is attempting to deploy a commit to the KeepHQ Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. Bug Something isn't working labels Jan 2, 2025
@talboren
Copy link
Member

talboren commented Jan 2, 2025

Thought we took care of it! Thank you.
I’ll push that in first thing in the morning

@talboren talboren changed the title event as list[AlertDTO] not included in the condition fix: event as list[AlertDTO] not included in the condition Jan 3, 2025
@talboren
Copy link
Member

talboren commented Jan 3, 2025

@00041275 may I ask you to create an issue for this PR too?

Copy link
Member

@talboren talboren left a comment

Choose a reason for hiding this comment

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

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 3, 2025
Copy link

vercel bot commented Jan 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
keep ⬜️ Ignored (Inspect) Visit Preview Jan 3, 2025 8:02pm

@00041275
Copy link
Contributor Author

00041275 commented Jan 3, 2025

created #2974

@talboren talboren enabled auto-merge (squash) January 3, 2025 20:07
@talboren talboren merged commit 0b5e146 into keephq:main Jan 3, 2025
11 of 12 checks passed
Copy link
Contributor

github-actions bot commented Jan 3, 2025

🚂 Well done @00041275! Two PRs merged already! 🎉🥳

With your second PR, you're on a roll, and your contributions are already making a difference. 🌟
Looking forward to seeing even more contributions from you. See you in Slack https://slack.keephq.dev 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[🐛 Bug]: _format_alert function in provider called with incorrect params
2 participants