-
Notifications
You must be signed in to change notification settings - Fork 897
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
Save Physical Chassis #17236
Save Physical Chassis #17236
Conversation
This pull request is not mergeable. Please rebase and repush. |
app/models/ext_management_system.rb
Outdated
@@ -66,6 +66,7 @@ def self.api_allowed_attributes | |||
has_many :storage_profiles, :foreign_key => "ems_id", :dependent => :destroy, :inverse_of => :ext_management_system | |||
has_many :physical_racks, :foreign_key => "ems_id", :dependent => :destroy, :inverse_of => :ext_management_system | |||
has_many :physical_switches, :foreign_key => "ems_id", :dependent => :destroy, :inverse_of => :ext_management_system | |||
has_many :physical_chassis, :foreign_key => "ems_id", :class_name => "PhysicalChassis", :dependent => :destroy, :inverse_of => :ext_management_system |
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.
Did you need the class_name just for the inflection? If so you can add it to https://github.com/ManageIQ/manageiq/tree/master/lib/vmdb/inflections.rb
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 already added the rule to the inflections.rb. This prevents rails from making physical_chassis become physical_chasses when It is mouting database queries. However, even with the inflections file, I still had to set this class_name. Seems like the inflections file is not considered in the instantiation of the ExtManagementSystem
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.
The error on the screenshot happens when I remove the ":class_name => "PhysicalChassis"
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.
That is because you need the capital inflection for the class names, see Queue/queue
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.
Right. I was using the inflections only to the table names. Now It is for Class Names too.
Checked commit https://github.com/caiocmpaes/manageiq/commit/35523efb7e7e1184955752580a7726c85418dbfc 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.
LGTM
This PR is able to save Physical Chassis model into ManageIQ. The choice for the name PhysicalChassis is in order to have consistency with PhysicalRack and PhysicalServer. I used the approach sugested in ManageIQ/manageiq#16853 to save the physical_rack and the physical_servers related to It.
Depends on: