Skip to content

Commit

Permalink
LBaaS Amazon refresh parser changes according to reviews
Browse files Browse the repository at this point in the history
LBaaS Amazon refresh parser changes according to reviews
  • Loading branch information
Ladas committed Aug 18, 2016
1 parent 73c5e73 commit c6b0738
Showing 1 changed file with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class ManageIQ::Providers::Amazon::NetworkManager::RefreshParser
def initialize(ems, options = nil)
@ems = ems
@aws_ec2 = ems.connect
@aws_elb = @ems.connect(:service => :ElasticLoadBalancing)
@aws_elb = ems.connect(:service => :ElasticLoadBalancing)
@data = {}
@data_index = {}
@options = options || {}
Expand Down Expand Up @@ -94,11 +94,11 @@ def get_load_balancer_pool_members
load_balancers.each do |lb|
new_lb = @data_index.fetch_path(:load_balancer_pools, lb.load_balancer_name)
load_balancer_pool_members = lb.instances.collect { |m| parse_load_balancer_pool_member(m) }
load_balancer_pool_members.each do |x|
load_balancer_pool_members.each do |member|
# Store all unique pool members
if @data_index.fetch_path(:load_balancer_pool_members, x[:ems_ref]).blank?
@data_index.store_path(:load_balancer_pool_members, x[:ems_ref], x)
@data[:load_balancer_pool_members] << x
if @data_index.fetch_path(:load_balancer_pool_members, member[:ems_ref]).blank?
@data_index.store_path(:load_balancer_pool_members, member[:ems_ref], member)
@data[:load_balancer_pool_members] << member
end
end

Expand Down Expand Up @@ -232,8 +232,7 @@ def parse_load_balancer(lb)
end

def parse_load_balancer_pool(lb)
uid = lb.load_balancer_name
name ||= uid
uid = name = lb.load_balancer_name

new_result = {
:type => self.class.load_balancer_pool_type,
Expand Down Expand Up @@ -291,9 +290,9 @@ def parse_load_balancer_health_check(lb)
port = target_match[2].to_i
url_path = target_match[3]

matched_listener = @data.fetch_path(:load_balancer_listeners).detect do |x|
x[:load_balancer][:ems_ref] == lb.load_balancer_name && x[:instance_port] == port &&
x[:instance_protocol] == protocol
matched_listener = @data.fetch_path(:load_balancer_listeners).detect do |listener|
listener[:load_balancer][:ems_ref] == lb.load_balancer_name && listener[:instance_port] == port &&
listener[:instance_protocol] == protocol
end

new_result = {
Expand Down

0 comments on commit c6b0738

Please sign in to comment.