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

Fix backwards compatibility issue in AWS provider's _get_credentials #20463

Merged

Conversation

potiuk
Copy link
Member

@potiuk potiuk commented Dec 22, 2021

The #19815 change introduced backwards incompatibility for
the _get_credentials method - which is a centerpiece of AWS
provider and is likely to be overwritten by the user who want
for example inject auditing or other credentials-related custom
beheviours when interfacing with AWS even if the method is
protected.

The change added default for region, which caused signature
incompatibility with such derived classes. Unfortunately, we
already released 2.5.0 provider with this change. We had to
yank it and in order to avoid adding backwards-incompatible
3.0.0 release we are going to release 2.5.1 with this change
included.

Fixes: #20457


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.

@potiuk
Copy link
Member Author

potiuk commented Dec 22, 2021

Once we review and merge this one I will prepare 2.5.1 release of the provider.

@potiuk
Copy link
Member Author

potiuk commented Dec 22, 2021

All test_base_aws.py passed locally after the changes.

The apache#19815 change introduced backwards incompatibility for
the _get_credentials method - which is a centerpiece of AWS
provider and is likely to be overwritten by the user who want
for example inject auditing or other credentials-related custom
beheviours when interfacing with AWS even if the method is
protected.

The change added default for region, which caused signature
incompatibility with such derived classes. Unfortunately, we
already released 2.5.0 provider with this change. We had to
yank it and in order to avoid adding backwards-incompatible
3.0.0 release we are going to release 2.5.1 with this change
included.

Fixes: apache#20457
@potiuk potiuk force-pushed the fix-interface-incompatibility-in-amazon-provider branch from fa3a306 to 1cb41e9 Compare December 22, 2021 15:33
Copy link
Member

@kaxil kaxil left a comment

Choose a reason for hiding this comment

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

lgtm but would wait till @dstandish or @uranusjr reviews it

@github-actions github-actions bot added the okay to merge It's ok to merge this PR as it does not require more tests label Dec 22, 2021
@github-actions
Copy link

The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease.

@potiuk potiuk merged commit 2ab2ae8 into apache:main Dec 22, 2021
@potiuk potiuk deleted the fix-interface-incompatibility-in-amazon-provider branch December 22, 2021 16:52
@potiuk
Copy link
Member Author

potiuk commented Dec 22, 2021

Aaaaah tooo fast :) (just saw your comment @kaxil @dstandish @uranusjr - let me know if there is anything to fix :)

@dstandish
Copy link
Contributor

nothing to fix i'd say but i am curious why we no longer let the hook handle auth more completely....

like it used to be

        s3_resource = self.get_resource_type('s3')
        return s3_resource.Bucket(bucket_name)

but as of this change we have much more complicated expression and get our hands more dirty. just curious for the reasoning on that. is there a reason not to let base hook handle giving us an authenticated resource, instead of repeating that logic within method calls?

also why not let region_name be optional (i.e. have a default of None) in _get_credentials? that doesn't necessarily harm backcompat

@potiuk
Copy link
Member Author

potiuk commented Dec 22, 2021

You'll find answers here @dstandish : #20457 (comment)

The backcompat is kinda unexpected. But somewhat realistic case (and I guess @kaxil and @uranusjr already got a report about it) when someone overrides the _get_credentials() "an old way" and expand_role() would fail in this case.

This is not obvious but might happen.

@potiuk
Copy link
Member Author

potiuk commented Dec 22, 2021

But yeah. In this case when I added the default to expand_role - it could be back set to None default.

@potiuk potiuk restored the fix-interface-incompatibility-in-amazon-provider branch April 26, 2022 20:53
@potiuk potiuk deleted the fix-interface-incompatibility-in-amazon-provider branch July 29, 2022 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers okay to merge It's ok to merge this PR as it does not require more tests provider:amazon-aws AWS/Amazon - related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Release 2.5.1 of Amazon Provider
3 participants