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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/models/middleware_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?

return true
end
false
Expand Down
2 changes: 1 addition & 1 deletion app/models/miq_alert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ def evaluate_in_automate(target, inputs = {})
end

def evaluate_internal(target, _inputs = {})
if target.class.name == 'MiddlewareServer'
if target.kind_of?(::MiddlewareServer)
method = "evaluate_middleware"
options = _inputs[:ems_event]
else
Expand Down