Skip to content

Commit

Permalink
Do not change passed extra attributes
Browse files Browse the repository at this point in the history
Do not change passed extra attributes, since that could affect another
inventory collections
  • Loading branch information
Ladas committed Feb 28, 2018
1 parent 0361ee0 commit 431dd0e
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def cloud_subnet_network_ports(extra_attributes = {})
:parent_inventory_collections => [:vms, :network_ports, :load_balancers],
}

extra_attributes[:targeted_arel] = lambda do |inventory_collection|
attributes[:targeted_arel] = lambda do |inventory_collection|
manager_uuids = inventory_collection.parent_inventory_collections.flat_map { |c| c.manager_uuids.to_a }
inventory_collection.parent.cloud_subnet_network_ports.references(:network_ports).where(
:network_ports => {:ems_ref => manager_uuids}
Expand Down Expand Up @@ -114,7 +114,7 @@ def load_balancer_pools(extra_attributes = {})
}
}

extra_attributes[:targeted_arel] = lambda do |inventory_collection|
attributes[:targeted_arel] = lambda do |inventory_collection|
manager_uuids = inventory_collection.parent_inventory_collections.flat_map { |c| c.manager_uuids.to_a }
inventory_collection.parent.load_balancer_pools.where(:ems_ref => manager_uuids)
end
Expand All @@ -132,10 +132,10 @@ def load_balancer_pool_members(extra_attributes = {})
}
}

extra_attributes[:targeted_arel] = lambda do |inventory_collection|
attributes[:targeted_arel] = lambda do |inventory_collection|
manager_uuids = inventory_collection.parent_inventory_collections.flat_map { |c| c.manager_uuids.to_a }
inventory_collection.parent.load_balancer_pool_members
.joins(:load_balancer_pool_member_pools => :load_balancer_pool)
.joins(:load_balancer_pool_member_pools => :load_balancler_pool)
.where(:load_balancer_pool_member_pools => {'load_balancer_pools' => {:ems_ref => manager_uuids}})
.distinct
end
Expand All @@ -151,7 +151,7 @@ def load_balancer_pool_member_pools(extra_attributes = {})
:parent_inventory_collections => [:load_balancers]
}

extra_attributes[:targeted_arel] = lambda do |inventory_collection|
attributes[:targeted_arel] = lambda do |inventory_collection|
manager_uuids = inventory_collection.parent_inventory_collections.flat_map { |c| c.manager_uuids.to_a }
inventory_collection.parent.load_balancer_pool_member_pools
.references(:load_balancer_pools)
Expand All @@ -173,7 +173,7 @@ def load_balancer_listeners(extra_attributes = {})
}
}

extra_attributes[:targeted_arel] = lambda do |inventory_collection|
attributes[:targeted_arel] = lambda do |inventory_collection|
manager_uuids = inventory_collection.parent_inventory_collections.flat_map { |c| c.manager_uuids.to_a }
inventory_collection.parent.load_balancer_listeners.joins(:load_balancer).where(
:load_balancers => {:ems_ref => manager_uuids}
Expand All @@ -191,7 +191,7 @@ def load_balancer_listener_pools(extra_attributes = {})
:parent_inventory_collections => [:load_balancers]
}

extra_attributes[:targeted_arel] = lambda do |inventory_collection|
attributes[:targeted_arel] = lambda do |inventory_collection|
manager_uuids = inventory_collection.parent_inventory_collections.flat_map { |c| c.manager_uuids.to_a }
inventory_collection.parent.load_balancer_listener_pools.joins(:load_balancer_pool).where(
:load_balancer_pools => {:ems_ref => manager_uuids}
Expand All @@ -211,7 +211,7 @@ def load_balancer_health_checks(extra_attributes = {})
}
}

extra_attributes[:targeted_arel] = lambda do |inventory_collection|
attributes[:targeted_arel] = lambda do |inventory_collection|
manager_uuids = inventory_collection.parent_inventory_collections.flat_map { |c| c.manager_uuids.to_a }
inventory_collection.parent.load_balancer_health_checks.where(:ems_ref => manager_uuids)
end
Expand All @@ -227,7 +227,7 @@ def load_balancer_health_check_members(extra_attributes = {})
:parent_inventory_collections => [:load_balancers],
}

extra_attributes[:targeted_arel] = lambda do |inventory_collection|
attributes[:targeted_arel] = lambda do |inventory_collection|
manager_uuids = inventory_collection.parent_inventory_collections.flat_map { |c| c.manager_uuids.to_a }
inventory_collection.parent.load_balancer_health_check_members.references(:load_balancer_health_checks).where(
:load_balancer_health_checks => {:ems_ref => manager_uuids}
Expand Down

0 comments on commit 431dd0e

Please sign in to comment.