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

Parsing physical_swtich_id and physical_chassis_id into events #205

Merged

Conversation

felipedf
Copy link
Member

@felipedf felipedf commented Jul 3, 2018

This PR is able to parse physical_switch_id into events, so we can handle events for switches.
Depends on: ManageIQ/manageiq-schema#229

@felipedf felipedf force-pushed the physical_switch_into_events branch 9 times, most recently from f56983a to 3049045 Compare July 6, 2018 12:17
@felipedf felipedf changed the title Parsing physical_swtich_id into events Parsing physical_swtich_id and physical_chassis_id into events Jul 6, 2018
@felipedf felipedf force-pushed the physical_switch_into_events branch from 3049045 to 7fdf7c2 Compare July 9, 2018 18:37
@CharlleDaniel CharlleDaniel self-requested a review July 24, 2018 17:54
elsif SERVER.include?(event[:component_type])
event_resources[:physical_server_id] = get_klass_id(PhysicalServer, event[:component_id])
else
raise(NotImplementedError, "The event of type #{event[:component_type]} is not supported")
Copy link
Member

@CharlleDaniel CharlleDaniel Jul 24, 2018

Choose a reason for hiding this comment

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

I think that is a little better only create a new log output like $log.error(message) instead of raise an exception. @felipedf and @douglasgabriel do you agree ?

Copy link
Member

Choose a reason for hiding this comment

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

Agreed

Copy link
Member

@douglasgabriel douglasgabriel left a comment

Choose a reason for hiding this comment

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

Just a few comments

@@ -32,7 +36,29 @@ def self.filter_data(data)
}
end

def self.get_physical_server_id(ems_ref)
PhysicalServer.find_by(:ems_ref => ems_ref).try(:id)
class << self
Copy link
Member

Choose a reason for hiding this comment

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

Request
To keep the consistency, you can wrap all class definitions with class << self

elsif SERVER.include?(event[:component_type])
event_resources[:physical_server_id] = get_klass_id(PhysicalServer, event[:component_id])
else
raise(NotImplementedError, "The event of type #{event[:component_type]} is not supported")
Copy link
Member

Choose a reason for hiding this comment

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

Agreed

event_resources
end

def get_klass_id(klass, uid_ems)
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion
In this method you are getting the id of the event resource, so I would say that the name get_resource_id fit better the goal of the method, don't you think?

@felipedf felipedf force-pushed the physical_switch_into_events branch 2 times, most recently from 3936017 to 9d12630 Compare August 8, 2018 11:21
@miq-bot
Copy link
Member

miq-bot commented Aug 8, 2018

Checked commit felipedf@9d12630 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
2 files checked, 0 offenses detected
Everything looks fine. ⭐

Copy link
Member

@douglasgabriel douglasgabriel left a comment

Choose a reason for hiding this comment

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

Thanks @felipedf , LGTM

@douglasgabriel douglasgabriel merged commit 7234759 into ManageIQ:master Aug 8, 2018
@felipedf felipedf deleted the physical_switch_into_events branch August 8, 2018 17:31
@agrare agrare added this to the Sprint 92 Ending Aug 13, 2018 milestone Aug 14, 2018
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.

5 participants