From a004c9d6e2907eaecb176b41de55abdbe8114618 Mon Sep 17 00:00:00 2001 From: Beni Cherniavsky-Paskin Date: Tue, 4 Jul 2017 15:33:41 +0300 Subject: [PATCH] avoid data_index for node's additional_attributes (untested) --- .../container_manager/refresh_parser.rb | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/models/manageiq/providers/kubernetes/container_manager/refresh_parser.rb b/app/models/manageiq/providers/kubernetes/container_manager/refresh_parser.rb index 80876814a0..8bf350decc 100644 --- a/app/models/manageiq/providers/kubernetes/container_manager/refresh_parser.rb +++ b/app/models/manageiq/providers/kubernetes/container_manager/refresh_parser.rb @@ -41,6 +41,7 @@ def ems_inv_to_hashes(inventory, _options = Config::Options.new) def ems_inv_to_inv_collections(ems, inventory, _options = Config::Options.new) initialize_inventory_collections(ems) + get_additional_attributes_graph(inventory) # TODO: untested? get_nodes_graph(inventory) get_namespaces_graph(inventory) get_resource_quotas_graph(inventory) @@ -209,6 +210,16 @@ def get_additional_attributes(inventory) ## InventoryObject Refresh methods + def get_additional_attributes_graph(inv) + (inv["additional_attributes"] || {}).each do |aa| + h = parse_additional_attribute(aa) + next if h.empty? || h[:node].nil? + + container_node = lazy_find_node(h.delete(:node)) + get_custom_attributes_graph(container_node, :additional_attributes => [h]) + end + end + def get_nodes_graph(inv) collection = @inv_collections[:container_nodes] @@ -218,16 +229,13 @@ def get_nodes_graph(inv) h.except!(:namespace, :tags) labels = h.delete(:labels) - additional_attributes = @data_index.fetch_path(:additional_attributes, :by_node, h[:name]) children = h.extract!(:container_conditions, :computer_system) container_node = collection.build(h) get_container_conditions_graph(container_node, children[:container_conditions]) get_node_computer_systems_graph(container_node, children[:computer_system]) - get_custom_attributes_graph(container_node, - :labels => labels, - :additional_attributes => additional_attributes) + get_custom_attributes_graph(container_node, :labels => labels) end end