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

Fixing middleware servers alert handling #16048

Merged
merged 1 commit into from
Oct 3, 2017

Conversation

israel-hdez
Copy link
Member

  • miq_alert: MiddlewareServers model has STI enabled. It's not enough to test against the class name to detect if target is a mw-server. Using kind_of?.
  • middleware_server: The format of the alert ids changed. Testing against the new id format in addition to the old one to check if alert should be handled.

This PR is part of a collection of PRs solving #15756.

* miq_alert: MiddlewareServers model has STI enabled. It's not
  enough to test against the class name to detect if target
  is a mw-server. Using kind_of?.
* middleware_server: The format of the alert ids changed.
  Testing against the new id format in addition to the old
  one to check if alert should be handled.
@israel-hdez
Copy link
Member Author

@miq-bot add_label bug, alerts, providers/hawkular

@miq-bot
Copy link
Member

miq-bot commented Sep 26, 2017

Checked commit israel-hdez@68cb336 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
2 files checked, 0 offenses detected
Everything looks fine. 👍

@abonas
Copy link
Member

abonas commented Sep 27, 2017

@lucasponce could you please review this?

@lucasponce
Copy link
Contributor

miq_alert: MiddlewareServers model has STI enabled. It's not enough to test against the class name to detect if target is a mw-server. Using kind_of?.

I am not familiar with STI, I understand that this fixes the previous logic to identify the class.

middleware_server: The format of the alert ids changed. Testing against the new id format in addition to the old one to check if alert should be handled.

That sounds good.

LGTM

@abonas
Copy link
Member

abonas commented Sep 28, 2017

LGTM
@miq-bot assign @chessbyte

Copy link

@cfcosta cfcosta left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@durandom durandom left a comment

Choose a reason for hiding this comment

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

please see my comment

@miq-bot assign @agrare

@@ -33,7 +33,8 @@ def evaluate_alert(alert_id, event)
s_start = event.full_data.index("id=\"") + 4
s_end = event.full_data.index("\"", s_start + 4) - 1
event_id = event.full_data[s_start..s_end]
if event_id.start_with?("MiQ-#{alert_id}") && event.middleware_server_id == id
if event.middleware_server_id == id && (
event_id.start_with?("MiQ-#{alert_id}") || event_id.start_with?(ext_management_system.miq_id_prefix))
Copy link
Member

Choose a reason for hiding this comment

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

how about moving that logic to your subclass?

ext_management_system.miq_id_prefix is a method that is only avail in Hawkular::MiddlewareManager

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, indeed evaluate_alert should be made abstract. All its code is specific to Hawkular. May I move the code in a follow-up PR?

BTW, the asignee didn't change.

Copy link
Member

Choose a reason for hiding this comment

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

I'm good with a followup PR for this, I'm not a fan of checking event_id.start_with? maybe you can try checking the source?

@agrare agrare assigned agrare and unassigned chessbyte Oct 3, 2017
Copy link
Member

@agrare agrare left a comment

Choose a reason for hiding this comment

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

I'm good with this for now, lets revisit in a follow up if there's a better way to identify an event without splitting on the event_id

@agrare agrare merged commit 68cb336 into ManageIQ:master Oct 3, 2017
agrare added a commit that referenced this pull request Oct 3, 2017
Fixing middleware servers alert handling
@agrare agrare added this to the Sprint 71 Ending Oct 16, 2017 milestone Oct 3, 2017
@israel-hdez israel-hdez deleted the iss15756 branch October 31, 2017 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants