Fix boto_route53 bug with (multiple) VPCs

This is a workaround because there is/was a bug in boto (see
boto/boto#3061 and boto/boto#2882 for more info) where VPCs were a list
with multiple, or a dict with one VPC. Now it won't matter if the return
is a dict or a list, we'll correctly process it.
This commit is contained in:
Wayne Werner 2021-05-25 15:33:18 -05:00 committed by Megan Wilhite
parent 7b23327bf8
commit 78df3f2b9a
2 changed files with 6 additions and 2 deletions

1
changelog/57139.fixed Normal file
View file

@ -0,0 +1 @@
Fix boto_route53 issue with (multiple) VPCs.

View file

@ -526,8 +526,11 @@ def hosted_zone_present(
create = True
else:
if private_zone:
for v, d in deets.get("VPCs", {}).items():
if d["VPCId"] == vpc_id and d["VPCRegion"] == vpc_region:
vpcs = deets.get("VPCs", [])
if isinstance(vpcs, dict):
vpcs = vpcs.values()
for vpc in vpcs:
if vpc["VPCId"] == vpc_id and vpc["VPCRegion"] == vpc_region:
create = False
break
else: