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

[PR #1428/fa58965f backport][stable-5] Fix detection of ssm connection bucket region #1564

Conversation

patchback[bot]
Copy link

@patchback patchback bot commented Oct 18, 2022

This is a backport of PR #1428 as merged into main (fa58965).

Fix detection of ssm connection bucket region by ensuring that the boto client is created normally and able to use supported credential sources

SUMMARY

PR #1176 introduced detection of an S3 bucket's region to handle cases where the bucket is in a different region than the SSM connection itself. This change did not use the preferred mechanism for creating client objects, which caused it to not have access to credentials from all supported sources. It also broke the ability to use this plugin in partitions other than aws. (e.g. aws-us-gov).

This change fixes this by building the bucket location client using _get_boto_client and the region for the connection to ensure it is both getting the proper credentials and starting in a region from the same partition as the client itself. From the default global region (or a hard-coded region), it will detect the bucket's region and continue S3 API calls using the bucket's own region.

Fixes bug introduced from #1176
Fixes #1413

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

aws_ssm connection plugin

Fix detection of ssm connection bucket region

Fix detection of ssm connection bucket region by ensuring that the boto client is created normally and able to use supported credential sources
SUMMARY
PR #1176 introduced detection of an S3 bucket's region to handle cases where the bucket is in a different region than the SSM connection itself. This change did not use the preferred mechanism for creating client objects, which caused it to not have access to credentials from all supported sources. It also broke the ability to use this plugin in partitions other than aws. (e.g. aws-us-gov).
This change fixes this by building the bucket location client using _get_boto_client and the region for the connection to ensure it is both getting the proper credentials and starting in a region from the same partition as the client itself. From the default global region (or a hard-coded region), it will detect the bucket's region and continue S3 API calls using the bucket's own region.
Fixes bug introduced from #1176
Fixes #1413
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
aws_ssm connection plugin

Reviewed-by: Markus Bergholz <[email protected]>
Reviewed-by: Alina Buzachis <None>
Reviewed-by: Mark Chappell <None>
(cherry picked from commit fa58965)
@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

✔️ ansible-galaxy-importer SUCCESS in 3m 52s
✔️ build-ansible-collection SUCCESS in 5m 25s
ansible-test-sanity-docker-devel FAILURE in 8m 14s (non-voting)
✔️ ansible-test-sanity-docker-milestone SUCCESS in 10m 04s
✔️ ansible-test-sanity-docker-stable-2.12 SUCCESS in 9m 06s
✔️ ansible-test-sanity-docker-stable-2.13 SUCCESS in 9m 51s
ansible-test-sanity-docker-stable-2.14 FAILURE in 8m 12s (non-voting)
✔️ ansible-test-units-amazon-aws-python36 SUCCESS in 6m 06s
✔️ ansible-test-units-amazon-aws-python38 SUCCESS in 5m 48s
✔️ ansible-test-units-amazon-aws-python39 SUCCESS in 7m 14s
✔️ ansible-test-splitter SUCCESS in 2m 46s
⚠️ integration-community.aws-1 SKIPPED
⚠️ integration-community.aws-2 SKIPPED
⚠️ integration-community.aws-3 SKIPPED
⚠️ integration-community.aws-4 SKIPPED
⚠️ integration-community.aws-5 SKIPPED
⚠️ integration-community.aws-6 SKIPPED
⚠️ integration-community.aws-7 SKIPPED
⚠️ integration-community.aws-8 SKIPPED
⚠️ integration-community.aws-9 SKIPPED
⚠️ integration-community.aws-10 SKIPPED
⚠️ integration-community.aws-11 SKIPPED
⚠️ integration-community.aws-12 SKIPPED
⚠️ integration-community.aws-13 SKIPPED
⚠️ integration-community.aws-14 SKIPPED
⚠️ integration-community.aws-15 SKIPPED
⚠️ integration-community.aws-16 SKIPPED
⚠️ integration-community.aws-17 SKIPPED
⚠️ integration-community.aws-18 SKIPPED
✔️ ansible-test-changelog SUCCESS in 2m 18s

@ansibullbot ansibullbot added bug This issue/PR relates to a bug community_review connection connection plugin needs_triage new_contributor Help guide this first time contributor plugins plugin (any type) labels Oct 18, 2022
@markuman markuman added mergeit Merge the PR (SoftwareFactory) and removed mergeit Merge the PR (SoftwareFactory) labels Nov 15, 2022
@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded (gate pipeline).

✔️ ansible-galaxy-importer SUCCESS in 4m 00s
✔️ build-ansible-collection SUCCESS in 5m 48s
✔️ ansible-test-sanity-docker-devel SUCCESS in 9m 31s (non-voting)
ansible-test-sanity-docker-milestone FAILURE in 8m 59s (non-voting)
✔️ ansible-test-sanity-docker-stable-2.12 SUCCESS in 9m 47s
✔️ ansible-test-sanity-docker-stable-2.13 SUCCESS in 8m 54s
✔️ ansible-test-sanity-docker-stable-2.14 SUCCESS in 9m 06s
✔️ ansible-test-units-amazon-aws-python36 SUCCESS in 5m 46s
✔️ ansible-test-units-amazon-aws-python38 SUCCESS in 6m 05s
✔️ ansible-test-units-amazon-aws-python39 SUCCESS in 5m 41s
✔️ ansible-test-changelog SUCCESS in 2m 22s
✔️ ansible-test-splitter SUCCESS in 2m 27s
⚠️ integration-community.aws-1 SKIPPED
⚠️ integration-community.aws-2 SKIPPED
⚠️ integration-community.aws-3 SKIPPED
⚠️ integration-community.aws-4 SKIPPED
⚠️ integration-community.aws-5 SKIPPED
⚠️ integration-community.aws-6 SKIPPED
⚠️ integration-community.aws-7 SKIPPED
⚠️ integration-community.aws-8 SKIPPED
⚠️ integration-community.aws-9 SKIPPED
⚠️ integration-community.aws-10 SKIPPED
⚠️ integration-community.aws-11 SKIPPED
⚠️ integration-community.aws-12 SKIPPED
⚠️ integration-community.aws-13 SKIPPED
⚠️ integration-community.aws-14 SKIPPED
⚠️ integration-community.aws-15 SKIPPED
⚠️ integration-community.aws-16 SKIPPED
⚠️ integration-community.aws-17 SKIPPED
⚠️ integration-community.aws-18 SKIPPED
⚠️ integration-community.aws-19 SKIPPED
⚠️ integration-community.aws-20 SKIPPED
⚠️ integration-community.aws-21 SKIPPED
⚠️ integration-community.aws-22 SKIPPED

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit cca23e2 into stable-5 Nov 20, 2022
@softwarefactory-project-zuul softwarefactory-project-zuul bot deleted the patchback/backports/stable-5/fa58965fceb8613d734242e552313199892c96d1/pr-1428 branch November 20, 2022 08:57
@github-actions
Copy link

Docs Build 📝

Thank you for contribution!✨

This PR has been merged and your docs changes will be incorporated when they are next published.

abikouo pushed a commit to abikouo/community.aws that referenced this pull request Oct 24, 2023
…sible-collections#1564)

Switch to Ansible Galaxy compatible requirements files for tests

SUMMARY
See ansible-community/community-topics#230.
ISSUE TYPE

Test Pull Request

COMPONENT NAME
test requirements files

Reviewed-by: Mark Chappell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug community_review connection connection plugin mergeit Merge the PR (SoftwareFactory) needs_triage new_contributor Help guide this first time contributor plugins plugin (any type)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants