check elb type in compare_subnets for elbv2 (#50203)

* Add check for elb type to fix difference between NLB and ALB AZ return structure

Fixes #49558

* Fix spacing for pep8 (hopefully) compliancE

* use empty array default instead of loadbalancer type detection

hat tip briantist

* spacing is probably important.
This commit is contained in:
Tad Merchant 2019-01-28 22:28:39 -05:00 committed by Will Thames
parent 98db75e7e7
commit 71ef69d51f

View file

@ -169,7 +169,7 @@ class ElasticLoadBalancerV2(object):
# on the load balancer # on the load balancer
for subnet in self.elb['AvailabilityZones']: for subnet in self.elb['AvailabilityZones']:
this_mapping = {'SubnetId': subnet['SubnetId']} this_mapping = {'SubnetId': subnet['SubnetId']}
for address in subnet['LoadBalancerAddresses']: for address in subnet.get('LoadBalancerAddresses', []):
if 'AllocationId' in address: if 'AllocationId' in address:
this_mapping['AllocationId'] = address['AllocationId'] this_mapping['AllocationId'] = address['AllocationId']
break break