mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[sns_topic] Don't mask non-authorization errors (#46030)
This commit is contained in:
parent
db5b65f5d6
commit
485320aab8
1 changed files with 4 additions and 2 deletions
|
@ -215,7 +215,7 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass # handled by AnsibleAWSModule
|
pass # handled by AnsibleAWSModule
|
||||||
|
|
||||||
from ansible.module_utils.aws.core import AnsibleAWSModule
|
from ansible.module_utils.aws.core import AnsibleAWSModule, is_boto3_error_code
|
||||||
from ansible.module_utils.ec2 import compare_policies, AWSRetry, camel_dict_to_snake_dict
|
from ansible.module_utils.ec2 import compare_policies, AWSRetry, camel_dict_to_snake_dict
|
||||||
|
|
||||||
|
|
||||||
|
@ -367,13 +367,15 @@ class SnsTopicManager(object):
|
||||||
def _list_topic_subscriptions(self):
|
def _list_topic_subscriptions(self):
|
||||||
try:
|
try:
|
||||||
return self._list_topic_subscriptions_with_backoff()
|
return self._list_topic_subscriptions_with_backoff()
|
||||||
except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:
|
except is_boto3_error_code('AuthorizationError'):
|
||||||
try:
|
try:
|
||||||
# potentially AuthorizationError when listing subscriptions for third party topic
|
# potentially AuthorizationError when listing subscriptions for third party topic
|
||||||
return [sub for sub in self._list_subscriptions_with_backoff()
|
return [sub for sub in self._list_subscriptions_with_backoff()
|
||||||
if sub['TopicArn'] == self.topic_arn]
|
if sub['TopicArn'] == self.topic_arn]
|
||||||
except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:
|
except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:
|
||||||
self.module.fail_json_aws(e, msg="Couldn't get subscriptions list for topic %s" % self.topic_arn)
|
self.module.fail_json_aws(e, msg="Couldn't get subscriptions list for topic %s" % self.topic_arn)
|
||||||
|
except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: # pylint: disable=duplicate-except
|
||||||
|
self.module.fail_json_aws(e, msg="Couldn't get subscriptions list for topic %s" % self.topic_arn)
|
||||||
|
|
||||||
def _delete_subscriptions(self):
|
def _delete_subscriptions(self):
|
||||||
# NOTE: subscriptions in 'PendingConfirmation' timeout in 3 days
|
# NOTE: subscriptions in 'PendingConfirmation' timeout in 3 days
|
||||||
|
|
Loading…
Reference in a new issue