Skip to content

Commit

Permalink
Merge pull request #17972 from EsdrasVP/fix_disks_save_inventory
Browse files Browse the repository at this point in the history
Fix Physical Disks save inventory
  • Loading branch information
agrare authored Sep 18, 2018
2 parents 156cd6b + 2f83774 commit cfacaf1
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions app/models/ems_refresh/save_inventory_physical_infra.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
child_keys = %i(computer_system asset_detail physical_disks canister)
save_inventory_multi(ems.physical_storages, hashes, deletes, [:ems_ref], child_keys)
store_ids_for_new_records(ems.physical_storages, hashes, :ems_ref)
end
Expand All @@ -115,11 +115,17 @@ def save_asset_detail_inventory(parent, hash)
end

#
# Saves the drive information of a storage
# Saves the disks information of a storage
#
def save_physical_disk_inventory(parent, hash)
return if hash.nil?
save_inventory_single(:physical_disk, parent, hash)
def save_physical_disks_inventory(physical_storage, hashes)
return if hashes.nil?

# Update the associated ids
hashes.each do |h|
h[:physical_storage_id] = h.delete(:physical_storage).try(:[], :id)
end

save_inventory_multi(physical_storage.physical_disks, hashes, :use_association, [:physical_storage_id])
end

#
Expand Down

0 comments on commit cfacaf1

Please sign in to comment.