Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

k-a-il
Copy link
Contributor

@k-a-il k-a-il commented Aug 19, 2025

Motivation

This PR introduces a plugin AWS license catalog which will be used to customize error messages for unimplemented AWS services or operations.

Downloading and loading of the license catalog is not implemented in this PR and will be completed in the next PR.

Changes

  • Add new license catalog plugin

@k-a-il k-a-il requested a review from bentsku August 19, 2025 14:59
@k-a-il k-a-il self-assigned this Aug 19, 2025
@k-a-il k-a-il changed the base branch from main to iac/catalog-skeleton August 19, 2025 14:59
@k-a-il k-a-il added the semver: patch Non-breaking changes which can be included in patch releases label Aug 19, 2025
Copy link

github-actions bot commented Aug 19, 2025

S3 Image Test Results (AMD64 / ARM64)

    2 files    2 suites   8m 18s ⏱️
  515 tests 465 ✅  50 💤 0 ❌
1 030 runs  930 ✅ 100 💤 0 ❌

Results for commit 961dbee.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Aug 19, 2025

Test Results - Preflight, Unit

22 157 tests  +12   20 419 ✅ +12   6m 53s ⏱️ +11s
     1 suites ± 0    1 738 💤 ± 0 
     1 files   ± 0        0 ❌ ± 0 

Results for commit 92e58e9. ± Comparison against base commit d5c781e.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@bentsku bentsku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nice 👌 super nice to see how easy it is to plug into this! this is only a pre-review as I got the notification, I'm still unsure how we are going to extend the behavior from Pro. Might be good to try it already to see how we could do it, and adapt the code in consequence? You might be on it already 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should still catch exceptions in the skeleton instead of letting them bubbling up to the proper exception handlers.

This doesn't need to be acted upon in this PR in particular, but it feels a bit weird to have the logic duplicated.

Copy link
Contributor Author

@k-a-il k-a-il Sep 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be addressed in this PR #13068

Comment on lines 46 to 50
def map_catalog_availability_to_exception(
service_name: str,
operation_name: str | None,
support_status: AwsServicesSupportInLatest | AwsServiceOperationsSupportInLatest,
) -> AwsServiceAvailabilityException:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: how will we extend this with more possible values in the Pro version? we might want to aim for it to be extended transparently, as we won't be able to plug into the Skeleton.on_not_implemented_error function directly to modify which function is being called.

We could probably patch it, and execute some code before deferring the logic to this function? maybe there are better ways. Patching might do, we're also using it for our AWS routing.

@k-a-il
Copy link
Contributor Author

k-a-il commented Aug 19, 2025

This is nice 👌 super nice to see how easy it is to plug into this! this is only a pre-review as I got the notification, I'm still unsure how we are going to extend the behavior from Pro. Might be good to try it already to see how we could do it, and adapt the code in consequence? You might be on it already 😄

Thanks, yes, I will extend this in pro tomorrow :) I also want to see how the whole integration will work before merging this PR

@k-a-il k-a-il requested a review from a team August 19, 2025 15:26
Copy link

github-actions bot commented Aug 19, 2025

LocalStack Community integration with Pro

    2 files  ±0      2 suites  ±0   1h 56m 5s ⏱️ -8s
4 659 tests ±0  4 328 ✅ ±0  331 💤 ±0  0 ❌ ±0 
4 661 runs  ±0  4 328 ✅ ±0  333 💤 ±0  0 ❌ ±0 

Results for commit 92e58e9. ± Comparison against base commit d5c781e.

♻️ This comment has been updated with latest results.

@k-a-il k-a-il added this to the 4.9 milestone Sep 4, 2025
@k-a-il k-a-il marked this pull request as ready for review September 5, 2025 11:47
@k-a-il k-a-il requested a review from thrau as a code owner September 5, 2025 11:47
@k-a-il k-a-il removed the request for review from thrau September 5, 2025 11:49
Copy link
Member

@silv-io silv-io left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! It's all very clean and easily understandable 😄🚀

I basically only have super minor nitpicks and some conceptual questions

Comment on lines 89 to 90
for emulator_type in list(LocalstackEmulatorType):
if emulator_type in service:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here with the emulator type

Copy link
Contributor

@bentsku bentsku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice addition with the plugins 🚀 thanks for addressing the comments, and making this looking really great and extendable!

I believe the RemoteCatalogLoader is currently broken and will break the functionality all together, but once this is addressed, I think we would be good to go 👍

Only have a few comments, agreeing with Silvio, and added some more related to some Enum being returned. Nice work 👌

@k-a-il k-a-il changed the base branch from iac/catalog-skeleton to main September 8, 2025 16:06
@k-a-il k-a-il added the needs-docs Pull request requires documentation updates label Sep 8, 2025
@k-a-il k-a-il requested a review from sannya-singal September 8, 2025 16:07
@k-a-il k-a-il force-pushed the iac/service-operation-exceptions branch from b2b69dc to 92e58e9 Compare September 15, 2025 07:11
@k-a-il k-a-il changed the title IaC: provide custom error messages based on AWS catalog data IaC: Add AWS operations and CFN resources catalog Sep 15, 2025
Copy link

Test Results (amd64) - Acceptance

7 tests  ±0   5 ✅ ±0   3m 3s ⏱️ -14s
1 suites ±0   2 💤 ±0 
1 files   ±0   0 ❌ ±0 

Results for commit 92e58e9. ± Comparison against base commit d5c781e.

@k-a-il
Copy link
Contributor Author

k-a-il commented Sep 15, 2025

I removed integration to service and skeleton to merge this PR faster

Copy link

github-actions bot commented Sep 15, 2025

Test Results (amd64) - Integration, Bootstrap

    5 files      5 suites   2h 33m 43s ⏱️
5 033 tests 4 542 ✅ 491 💤 0 ❌
5 039 runs  4 542 ✅ 497 💤 0 ❌

Results for commit 92e58e9.

♻️ This comment has been updated with latest results.

@bentsku bentsku self-requested a review September 15, 2025 15:01
Copy link
Contributor

@bentsku bentsku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I only have some questions around the fallback for the Pro "runtime-only" Catalog, but this could also be addressed in a follow-up PR 👍, once we know more.

Thanks for splitting the PR so that we don't alter the behavior right away! 🚀

Comment on lines +97 to +101
self.cfn_resources_in_latest = AwsCatalogRemoteStatePlugin.get_cfn_resources_catalog(
remote_catalog.cloudformation_resources
)
self.cfn_resources_at_runtime = set(cfn_plugin_manager.list_names())
self.services_at_runtime = AwsCatalogRemoteStatePlugin.get_aws_services_at_runtime()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: would it make more sense to call those 2 methods via the self instance, even if they are static methods?

"Failed to load catalog plugin with the latest LocalStack services support data, falling back to catalog without remote state: %s",
e,
)
return plugin_manager.load("aws-catalog-runtime-only")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: should we maybe have a different fallback for the Pro version?

Currently, if I understood well, the Runtime-only fallback doesn't do anything in Community, because it cannot access any licensing data, and won't provide additional features at all. I can see how this works for the 501 error, it will just fallback to what we had before.

For CloudFormation, I'm not sure what the behavior will be if we return None, but I'm sure we can handle it, so for now I don't see a big issue.

However, for the Pro "runtime fallback", we will have additional data even without the remote catalog: for example, if the service is in another tier, etc. So there we should probably share code for the runtime part between the 2 catalogs (remote and runtime-only). Not sure if I'm making sense here 😄

Comment on lines +19 to +24
except Exception as e:
LOG.debug(
"Failed to load catalog plugin with the latest LocalStack services support data, falling back to catalog without remote state: %s",
e,
)
return plugin_manager.load("aws-catalog-runtime-only")
Copy link
Contributor

@bentsku bentsku Sep 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something I missed: I believe we should maybe raise a specific exception we would have subclassed ourselves in case we have a failure in the RemoteCatalogLoader, so that we could probably guard only against this? because here, if we have any kind of exceptions when instantiating the Catalog, we would fallback, even if the exception is something we should fix, like a Key error or something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-docs Pull request requires documentation updates semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants