Skip to content

Commit

Permalink
Ensure that genealogy_parent exists in the vm data before using it
Browse files Browse the repository at this point in the history
  • Loading branch information
mansam committed Apr 12, 2017
1 parent 7fe01a5 commit f4873fb
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,10 @@ def vm_and_miq_template_ancestry(extra_attributes = {})

# Fetch IDs of all vms and genealogy_parents, only if genealogy_parent is present
vms_genealogy_parents = vms_inventory_collection.data.each_with_object({}) do |x, obj|
genealogy_parent_id = x.data[:genealogy_parent].load.try(:id)
obj[x.id] = genealogy_parent_id if genealogy_parent_id
unless x.data[:genealogy_parent].nil?
genealogy_parent_id = x.data[:genealogy_parent].load.try(:id)
obj[x.id] = genealogy_parent_id if genealogy_parent_id
end
end

miq_templates = miq_templates_inventory_collection.model_class
Expand Down

0 comments on commit f4873fb

Please sign in to comment.