From 56c78ee39f8dc82f60ce2dd76c0a0637e930ce9b Mon Sep 17 00:00:00 2001 From: Nick Stocchero Date: Mon, 21 Sep 2020 17:42:22 -0600 Subject: [PATCH] use get instead of direct dict access --- moto/iam/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/moto/iam/config.py b/moto/iam/config.py index 2f2cafa5f..018709346 100644 --- a/moto/iam/config.py +++ b/moto/iam/config.py @@ -61,10 +61,10 @@ class RoleConfigQuery(ConfigQueryModel): ) or aggregator.get("organization_aggregation_source") for source in aggregator_sources: source_dict = source.__dict__ - if source_dict["all_aws_regions"]: + if source_dict.get("all_aws_regions", False): aggregated_regions = boto3.Session().get_available_regions("config") break - for region in source_dict["aws_regions"]: + for region in source_dict.get("aws_regions", []): aggregated_regions.append(region) duplicate_role_list = []