From a23dfce2c90e87878897e42d6ac5bbf11ceb420e Mon Sep 17 00:00:00 2001 From: Jonathan Date: Sat, 1 Sep 2018 22:17:25 -0400 Subject: [PATCH] Added default value for when CloudFrontOriginAccessIdentityList is (#44984) missing. (cherry picked from commit 93cd0502505822eda5b16c0017d8a0394e16c605) --- changelogs/fragments/fix_44984.yaml | 2 ++ lib/ansible/module_utils/aws/cloudfront_facts.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/fix_44984.yaml diff --git a/changelogs/fragments/fix_44984.yaml b/changelogs/fragments/fix_44984.yaml new file mode 100644 index 00000000000..10bfb8716a0 --- /dev/null +++ b/changelogs/fragments/fix_44984.yaml @@ -0,0 +1,2 @@ +bugfixes: +- cloudfront - fix bug when CloudFrontOriginAccessIdentityList is missing (https://github.com/ansible/ansible/pull/44984) diff --git a/lib/ansible/module_utils/aws/cloudfront_facts.py b/lib/ansible/module_utils/aws/cloudfront_facts.py index 37b41de1599..cd6f76fb817 100644 --- a/lib/ansible/module_utils/aws/cloudfront_facts.py +++ b/lib/ansible/module_utils/aws/cloudfront_facts.py @@ -93,7 +93,7 @@ class CloudFrontFactsServiceManager(object): def list_origin_access_identities(self): try: paginator = self.client.get_paginator('list_cloud_front_origin_access_identities') - result = paginator.paginate().build_full_result()['CloudFrontOriginAccessIdentityList'] + result = paginator.paginate().build_full_result().get('CloudFrontOriginAccessIdentityList', {}) return result.get('Items', []) except botocore.exceptions.ClientError as e: self.module.fail_json_aws(e, msg="Error listing cloud front origin access identities")