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

Remove usage of GenericBaseModel outside of LegacyResourceProvider #8711

Merged
merged 18 commits into from Jul 26, 2023

Conversation

dominikschubert
Copy link
Member

@dominikschubert dominikschubert commented Jul 17, 2023

Changes

  • Introduced CFN_IGNORE_UNSUPPORTED_RESOURCE_TYPES config variable to determine if we should fail if a resource type doesn't exist. E.g. setting CFN_IGNORE_UNSUPPORTED_RESOURCE_TYPES=0 will cause a stack deployment to fail if the resource type doesn't have an associated provider.
  • Removed any access to RESOURCE_MODELS, i.e. the GenericBaseModel classes in the template_deployer, except the current fallback for retrieving Fn::GetAtt targets that still needs to use them. If we refactor the models to remove all get_cfn_attribute calls, we can delete this completely.
  • Removed retrieve_resource_details
  • Removed extract_resource_attribute
  • Removed a lot of unnecessary code from resolve_ref
  • Removed get_resource_model_instance
  • Removed invoke_function (unused)
  • Removed get_ref_from_model => simple physical resource ID lookup now
  • Removed determine_resource_physical_id => simple physical resource ID lookup now
  • Removed is_deployable_resource and is_updateable => everything should be a "deployable resource" and is_updateable is now only used in the LegacyResourceProvider
  • Removed update_resource_details => this was a bit of a headache unfortunately since it was responsible for populating the _state_, i.e. the result of the fetch_state call in the models. This initially broke UPDATEs on the old models. I've introduced a workaround for Add and Modify operations in the LegacyResourceProvider. It's a bit hacky but we also shouldn't let those currently 15 resources with (partial) UPDATE support live for too long as GenericBaseModels anyway.
  • Removed GenericBaseModel.get_ref
  • Removed GenericBaseModel.fetch_state_if_missing

@dominikschubert dominikschubert self-assigned this Jul 17, 2023
@github-actions
Copy link

github-actions bot commented Jul 17, 2023

LocalStack Community integration with Pro

       2 files         2 suites   1h 24m 14s ⏱️
2 246 tests 1 902 ✔️ 344 💤 0
2 247 runs  1 902 ✔️ 345 💤 0

Results for commit ff92102.

♻️ This comment has been updated with latest results.

@dfangl dfangl added this to the Playground milestone Jul 17, 2023
@dominikschubert dominikschubert added the semver: patch Non-breaking changes which can be included in patch releases label Jul 17, 2023
@dominikschubert dominikschubert force-pushed the cfn-remove-usage-of-genericbasemodel branch from 57d9a84 to 14cef9a Compare July 18, 2023 06:57
@coveralls
Copy link

coveralls commented Jul 18, 2023

Coverage Status

coverage: 82.339% (+0.02%) from 82.324% when pulling 5cbb717 on cfn-remove-usage-of-genericbasemodel into 93dd6f7 on master.

@@ -328,7 +328,7 @@ def test_describe_change_set_nonexisting(snapshot, aws_client):
snapshot.match("exception", ex.value)


@pytest.mark.xfail(reason="fails because of the properties mutation in the result_handler")
@pytest.mark.skip(reason="fails because of the properties mutation in the result_handler")
Copy link
Member Author

Choose a reason for hiding this comment

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

don't see a point in waiting 5min for all the timeouts here, so this should speed up the tests a bit 😅


if config.CFN_IGNORE_UNSUPPORTED_RESOURCE_TYPES:
# TODO: figure out a better way to handle non-implemented here?
return ProgressEvent(OperationStatus.SUCCESS, resource_model={})
Copy link
Member Author

Choose a reason for hiding this comment

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

not sure about the returned model here

@dominikschubert dominikschubert marked this pull request as ready for review July 18, 2023 13:27
@dominikschubert dominikschubert removed the request for review from dfangl July 18, 2023 13:28
@dominikschubert dominikschubert added semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases and removed semver: patch Non-breaking changes which can be included in patch releases labels Jul 18, 2023
@thrau thrau removed their request for review July 18, 2023 13:56
@dominikschubert dominikschubert modified the milestones: Playground, 2.3 Jul 18, 2023
@dominikschubert dominikschubert marked this pull request as draft July 18, 2023 15:30
Copy link
Contributor

@simonrw simonrw left a comment

Choose a reason for hiding this comment

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

Looks like some great changes, I love the overall negative number of lines changed!

@dominikschubert dominikschubert force-pushed the cfn-remove-usage-of-genericbasemodel branch from cd5675f to 2ff3f6c Compare July 18, 2023 16:54
Copy link
Member

@pinzon pinzon left a comment

Choose a reason for hiding this comment

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

Awesome!!!

@dominikschubert dominikschubert force-pushed the cfn-remove-usage-of-genericbasemodel branch from bd66bc2 to 5cbb717 Compare July 20, 2023 15:10
@dominikschubert dominikschubert marked this pull request as ready for review July 20, 2023 15:26
@dominikschubert dominikschubert force-pushed the cfn-remove-usage-of-genericbasemodel branch from 5cbb717 to 889a301 Compare July 26, 2023 05:47
@dominikschubert dominikschubert merged commit 4c40c70 into master Jul 26, 2023
25 checks passed
@alexrashed alexrashed deleted the cfn-remove-usage-of-genericbasemodel branch November 28, 2023 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants