Skip to content

Commit

Permalink
Fix Canisters save inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
EsdrasVP committed Sep 19, 2018
1 parent cfacaf1 commit 2dc8d1c
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 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_disks canister)
child_keys = %i(computer_system asset_detail physical_disks canisters)
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 Down Expand Up @@ -129,11 +129,18 @@ def save_physical_disks_inventory(physical_storage, hashes)
end

#
# Saves the canister information of a storage
# Saves the canisters information of a storage
#
def save_canister_inventory(physical_storage, hash)
return if hash.nil?
save_inventory_single(:canister, physical_storage, hash)
def save_canisters_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

child_keys = %i(computer_system)
save_inventory_multi(physical_storage.canisters, hashes, :use_association, [:physical_storage_id], child_keys)
end

def save_physical_network_ports_inventory(guest_device, hashes, target = nil)
Expand Down

0 comments on commit 2dc8d1c

Please sign in to comment.