-
Notifications
You must be signed in to change notification settings - Fork 66
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
Parsing physical_swtich_id and physical_chassis_id into events #205
Conversation
f56983a
to
3049045
Compare
3049045
to
7fdf7c2
Compare
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") |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed
There was a problem hiding this 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 |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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?
3936017
to
9d12630
Compare
Checked commit felipedf@9d12630 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @felipedf , LGTM
This PR is able to parse
physical_switch_id
into events, so we can handle events for switches.Depends on: ManageIQ/manageiq-schema#229