From 50eb2f69574e63f50975cd4d28ca16b941ceb1b8 Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Wed, 5 Feb 2020 18:16:07 +0100 Subject: [PATCH] sns_topic: Retry on Topic 'NotFound' Exceptions when attempting to list subscriptions (#67089) * sns_topic: Retry on Topic 'NotFound' Exceptions when attempting to list subscriptions * add changelog --- changelogs/fragments/67089-sns_topic-notfound-backoff.yaml | 2 ++ lib/ansible/modules/cloud/amazon/sns_topic.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/67089-sns_topic-notfound-backoff.yaml diff --git a/changelogs/fragments/67089-sns_topic-notfound-backoff.yaml b/changelogs/fragments/67089-sns_topic-notfound-backoff.yaml new file mode 100644 index 00000000000..dcd01aad484 --- /dev/null +++ b/changelogs/fragments/67089-sns_topic-notfound-backoff.yaml @@ -0,0 +1,2 @@ +minor_changes: +- sns_topic - Add backoff when we get Topic ``NotFound`` exceptions while listing the subscriptions. diff --git a/lib/ansible/modules/cloud/amazon/sns_topic.py b/lib/ansible/modules/cloud/amazon/sns_topic.py index 48248a9d44e..d0059d1359b 100644 --- a/lib/ansible/modules/cloud/amazon/sns_topic.py +++ b/lib/ansible/modules/cloud/amazon/sns_topic.py @@ -264,12 +264,12 @@ class SnsTopicManager(object): paginator = self.connection.get_paginator('list_topics') return paginator.paginate().build_full_result()['Topics'] - @AWSRetry.jittered_backoff() + @AWSRetry.jittered_backoff(catch_extra_error_codes=['NotFound']) def _list_topic_subscriptions_with_backoff(self): paginator = self.connection.get_paginator('list_subscriptions_by_topic') return paginator.paginate(TopicArn=self.topic_arn).build_full_result()['Subscriptions'] - @AWSRetry.jittered_backoff() + @AWSRetry.jittered_backoff(catch_extra_error_codes=['NotFound']) def _list_subscriptions_with_backoff(self): paginator = self.connection.get_paginator('list_subscriptions') return paginator.paginate().build_full_result()['Subscriptions']