Fixes #38085 - cloudfront_invalidation doesn't work for the first invalidation ever (#38086)

pull/38197/head
Gennady Aleksandrov 7 years ago committed by Will Thames
parent 2d90f50eeb
commit 67cd641c04

@ -181,7 +181,7 @@ class CloudFrontInvalidationServiceManager(object):
# find all invalidations for the distribution # find all invalidations for the distribution
try: try:
paginator = self.client.get_paginator('list_invalidations') paginator = self.client.get_paginator('list_invalidations')
invalidations = paginator.paginate(DistributionId=distribution_id).build_full_result()['InvalidationList'].get('Items', []) invalidations = paginator.paginate(DistributionId=distribution_id).build_full_result().get('InvalidationList', {}).get('Items', [])
invalidation_ids = [inv['Id'] for inv in invalidations] invalidation_ids = [inv['Id'] for inv in invalidations]
except (BotoCoreError, ClientError) as e: except (BotoCoreError, ClientError) as e:
self.module.fail_json_aws(e, msg="Error listing CloudFront invalidations.") self.module.fail_json_aws(e, msg="Error listing CloudFront invalidations.")

Loading…
Cancel
Save