Skip to content

Commit

Permalink
elasticache_info: ignore CacheClusterNotFound exeption during tag col…
Browse files Browse the repository at this point in the history
…lect (#1777)

elasticache_info: ignore CacheClusterNotFound exeption during tag collect

If we call get_elasticache_tags_with_backoff() on a cluster with an invalid
state (eg: deleting), AWS will trigger an CacheClusterNotFound.
With this change, elasticache_info will ignore the cluster and continue with
the next one.

Reviewed-by: Mark Chappell
(cherry picked from commit 5461b2e)
  • Loading branch information
goneri authored and patchback[bot] committed Apr 19, 2023
1 parent 7755165 commit bcbcb5f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- "elasticache_info - Ignore the CacheClusterNotFound exception when collecting tags (https://github.com/ansible-collections/community.aws/pull/1777)."
3 changes: 3 additions & 0 deletions plugins/modules/elasticache_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,9 @@ def get_elasticache_clusters(client, module):
arn = "arn:aws:elasticache:%s:%s:cluster:%s" % (region, account_id, cluster['cache_cluster_id'])
try:
tags = get_elasticache_tags_with_backoff(client, arn)
except is_boto3_error_code("CacheClusterNotFound"):
# e.g: Cluster was listed but is in deleting state
continue
except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:
module.fail_json_aws(e, msg="Couldn't get tags for cluster %s")

Expand Down

0 comments on commit bcbcb5f

Please sign in to comment.