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 get_cfn_attribute from legacy models #8717

Merged
merged 23 commits into from Jul 28, 2023

Conversation

dominikschubert
Copy link
Member

@dominikschubert dominikschubert commented Jul 18, 2023

Removes all usage of get_cfn_attribute from the community resource models.

It does not yet introduce a subset selection for the migrated resources to stay in parity with the previous behavior for now where we nearly always fall back to a direct property/state lookup.

A follow-up PR will soon remove the base method from the GenericBaseModel and unify the code paths between old and legacy providers.

@github-actions
Copy link

github-actions bot commented Jul 18, 2023

LocalStack Community integration with Pro

       2 files         2 suites   1h 19m 47s ⏱️
2 256 tests 1 904 ✔️ 352 💤 0
2 257 runs  1 904 ✔️ 353 💤 0

Results for commit a0356e1.

♻️ This comment has been updated with latest results.

@dominikschubert dominikschubert added the semver: patch Non-breaking changes which can be included in patch releases label Jul 27, 2023
@dominikschubert dominikschubert self-assigned this Jul 27, 2023
@coveralls
Copy link

coveralls commented Jul 27, 2023

Coverage Status

coverage: 82.437% (+0.04%) from 82.399% when pulling a0356e1 on cfn-remove-get-cfn-attribute into b8d2ed2 on master.

@dominikschubert dominikschubert changed the title Unify GetAtt attribute access between legacy and new resource providers Remove get_cfn_attribute from legacy models Jul 27, 2023
@dominikschubert dominikschubert marked this pull request as ready for review July 27, 2023 15:08
Comment on lines 91 to 96
if "." in attribute_name:
parts = attribute_name.split(".")
attribute = self.props
for part in parts:
attribute = attribute.get(part)
return attribute
Copy link
Member Author

Choose a reason for hiding this comment

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

just temporary, since this whole method will soon be removed. this will enable resolving properties like Outputs.NestedStackOutputA

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!!

Comment on lines +18 to +23
# def fetch_state(self, stack_name, resources):
# client = connect_to().cloudformation
# child_stack_name = self.props["StackName"]
# result = client.describe_stacks(StackName=child_stack_name)
# result = (result.get("Stacks") or [None])[0]
# return result
Copy link
Member Author

Choose a reason for hiding this comment

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

commented out for now, I'll probably churn through the models and check where we can delete fetch_state implementations after the two PRs are merged 😄

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 good, glad to see we can get rid of the custom get_cfn_attribute handling and move towards the resource provider way of doing things

@dominikschubert dominikschubert merged commit d2778dd into master Jul 28, 2023
25 checks passed
@dominikschubert dominikschubert deleted the cfn-remove-get-cfn-attribute branch July 28, 2023 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

None yet

4 participants