-
Notifications
You must be signed in to change notification settings - Fork 898
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 Computer System relationship on Physical Storage #17945
Conversation
d792c6f
to
d12a2f3
Compare
@@ -9,10 +9,6 @@ class PhysicalStorage < ApplicationRecord | |||
has_one :asset_detail, :as => :resource, :dependent => :destroy, :inverse_of => false | |||
|
|||
has_many :canisters, :dependent => :destroy, :inverse_of => false | |||
has_many :computer_system, :through => :canisters | |||
has_many :hardware, :through => :computer_system | |||
has_many :guest_devices, :through => :canisters |
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.
Do you need to delete these? Thought you just had to change to `:computer_systems
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.
@agrare Initially I thought that just fix the pluralization would do the job, but talking with the team we noted that it didn't make sense to let these relationships on PhysicalStorage since they're already in Canister. So I updated this PR title and description to fit the changes.
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.
from the UI side, no problem with this, the failing test caused by the other PR was really just the rename, fixed in ManageIQ/manageiq-ui-classic#4602 (so we're no longer touching PhysicalStorage#computer_system
at all)
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.
👍 sorry for the disruption @himdel
@@ -101,7 +101,7 @@ def save_physical_storages_inventory(ems, hashes, target = nil) | |||
h[:physical_chassis_id] = h.delete(:physical_chassis).try(:[], :id) | |||
end | |||
|
|||
child_keys = %i(computer_system asset_detail physical_disk canister) |
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.
So should there be a computer_system child_key in save_canisters_inventory?
@EsdrasVP thinking about this a bit more, I think we should leave the |
d12a2f3
to
c4e15d9
Compare
@agrare Makes sense, I'm changing to this and on the provider PR I moved the computer system parse from PhysicalStorage to Canister. |
51f6518
to
79f4547
Compare
has_many :physical_disks, :dependent => :destroy, :inverse_of => :physical_storage | ||
|
||
has_one :computer_system, :as => :managed_entity, :dependent => :destroy |
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.
You're still missing the previous relations (:hardware, :guest_devices)
IMO this should go back to before #17706 and just add has_many :canisters
and has_many :canister_computer_systems
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.
@agrare Fixed it, and put :guest_devices
through :hardware
in order to be more general for other providers.
79f4547
to
a774358
Compare
Checked commit EsdrasVP@a774358 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 app/models/physical_storage.rb
|
This PR is able to: