Skip to content

Commit

Permalink
avoid data_index for node's additional_attributes (untested)
Browse files Browse the repository at this point in the history
  • Loading branch information
cben committed Jul 4, 2017
1 parent 5acbc0d commit a004c9d
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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]

Expand All @@ -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

Expand Down

0 comments on commit a004c9d

Please sign in to comment.