From 71ef69d51f78f68670bc0d0f357afbcb7b0c0631 Mon Sep 17 00:00:00 2001 From: Tad Merchant Date: Mon, 28 Jan 2019 22:28:39 -0500 Subject: [PATCH] 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. --- lib/ansible/module_utils/aws/elbv2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/aws/elbv2.py b/lib/ansible/module_utils/aws/elbv2.py index f7e7ecaf5e..47d0e87a51 100644 --- a/lib/ansible/module_utils/aws/elbv2.py +++ b/lib/ansible/module_utils/aws/elbv2.py @@ -169,7 +169,7 @@ class ElasticLoadBalancerV2(object): # on the load balancer for subnet in self.elb['AvailabilityZones']: this_mapping = {'SubnetId': subnet['SubnetId']} - for address in subnet['LoadBalancerAddresses']: + for address in subnet.get('LoadBalancerAddresses', []): if 'AllocationId' in address: this_mapping['AllocationId'] = address['AllocationId'] break