Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws - elasticsearch - fix error handling of boto3 #9070

Merged
merged 3 commits into from
Oct 17, 2023

Conversation

DawnElixir
Copy link
Contributor

Fix error handling of boto3 exception ResourceNotFoundException

DawnElixir and others added 3 commits October 16, 2023 16:53
Fix typo of ResourceNotFoundException
- AddTags and RemoveTags appear to throw ValidationExceptions rather
  than ResourceNotFound when targeting a non-existent domain

- The cross-cluster filter uses a filter parameter on the underlying API
  call, so when looking for a non-existent domain it will return an
  empty result set rather than throwing an error
@ajkerrigan
Copy link
Member

ajkerrigan commented Oct 17, 2023

Hey @DawnElixir good catch on the typo there, thanks for filing!

While adding tests for this I realized that fixing the typo didn't fix the behavior. Because:

  • In the cross-cluster filter we're using a server-side filter to limit the result set. So if there's no domain, rather than an error we just get an empty result set which leads to the resource not matching the filter 👍 .
  • In the tag and remove-tag actions, trying to target a deleted domain seems to throw a validation error rather than a not found one. This is consistent with the API docs (example).

So I've added a test for tagging/untagging a non-existent domain and tweaked the logic as needed. It looks like we already have something that tries to cover the cross-cluster piece.

@ajkerrigan ajkerrigan merged commit d01baaf into cloud-custodian:main Oct 17, 2023
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants