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) (#1778)

[PR #1777/5461b2e2 backport][stable-5] elasticache_info: ignore CacheClusterNotFound exeption during tag collect

This is a backport of PR #1777 as merged into main (5461b2e).
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
  • Loading branch information
patchback[bot] authored Apr 19, 2023
1 parent 7755165 commit 0344815
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 0344815

Please sign in to comment.