diff --git a/lib/fog/aws/parsers/elbv2/describe_load_balancers.rb b/lib/fog/aws/parsers/elbv2/describe_load_balancers.rb index 71ac386a9..876437780 100644 --- a/lib/fog/aws/parsers/elbv2/describe_load_balancers.rb +++ b/lib/fog/aws/parsers/elbv2/describe_load_balancers.rb @@ -5,7 +5,7 @@ module Fog class DescribeLoadBalancers < Fog::Parsers::Base def reset reset_load_balancer - @availability_zone = { 'LoadBalancerAddresses' => [] } + reset_availability_zone @load_balancer_addresses = {} @state = {} @results = { 'LoadBalancers' => [] } @@ -16,6 +16,10 @@ module Fog @load_balancer = { 'SecurityGroups' => [], 'AvailabilityZones' => [] } end + def reset_availability_zone + @availability_zone = { 'LoadBalancerAddresses' => [] } + end + def start_element(name, attrs = []) super case name @@ -37,7 +41,7 @@ module Fog @availability_zone['LoadBalancerAddresses'] << @load_balancer_addresses elsif @in_availability_zones @load_balancer['AvailabilityZones'] << @availability_zone - @availability_zone = {} + reset_availability_zone elsif @in_security_groups @load_balancer['SecurityGroups'] << value else diff --git a/tests/parsers/elbv2/describe_load_balancers_tests.rb b/tests/parsers/elbv2/describe_load_balancers_tests.rb index 3ed989e03..e92496a35 100644 --- a/tests/parsers/elbv2/describe_load_balancers_tests.rb +++ b/tests/parsers/elbv2/describe_load_balancers_tests.rb @@ -20,6 +20,12 @@ DESCRIBE_LOAD_BALANCERS_RESULT = <<-EOF subnet-b7d581c0 us-west-2b + + + 127.0.0.1 + eipalloc-1c2ab192c131q2377 + + diff --git a/tests/requests/elbv2/helper.rb b/tests/requests/elbv2/helper.rb index 2977dca6b..7779e53d3 100644 --- a/tests/requests/elbv2/helper.rb +++ b/tests/requests/elbv2/helper.rb @@ -6,7 +6,10 @@ class AWS } LOAD_BALANCER = { - "AvailabilityZones" => Array, + "AvailabilityZones" => [{ + "SubnetId" => String, "ZoneName" => String, + "LoadBalancerAddresses" => [Fog::Nullable::Hash] + }], "LoadBalancerArn" => String, "DNSName" => String, "CreatedTime" => Time,