community.aws icon indicating copy to clipboard operation
community.aws copied to clipboard

Fix detection of ssm connection bucket region

Open phene opened this issue 3 years ago • 4 comments

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

phene avatar Aug 30 '22 00:08 phene

Build succeeded.

:heavy_check_mark: ansible-galaxy-importer SUCCESS in 7m 40s :heavy_check_mark: build-ansible-collection SUCCESS in 13m 25s :heavy_check_mark: ansible-test-sanity-docker-devel SUCCESS in 16m 23s (non-voting) :heavy_check_mark: ansible-test-sanity-docker-milestone SUCCESS in 16m 40s :heavy_check_mark: ansible-test-sanity-docker-stable-2.12 SUCCESS in 15m 28s :heavy_check_mark: ansible-test-sanity-docker-stable-2.13 SUCCESS in 17m 25s :heavy_check_mark: ansible-test-units-community-aws-python38 SUCCESS in 11m 25s :heavy_check_mark: ansible-test-units-community-aws-python39 SUCCESS in 13m 18s :heavy_check_mark: ansible-test-splitter SUCCESS in 6m 41s :warning: integration-community.aws-1 SKIPPED :warning: integration-community.aws-2 SKIPPED :warning: integration-community.aws-3 SKIPPED :warning: integration-community.aws-4 SKIPPED :warning: integration-community.aws-5 SKIPPED :warning: integration-community.aws-6 SKIPPED :warning: integration-community.aws-7 SKIPPED :warning: integration-community.aws-8 SKIPPED :warning: integration-community.aws-9 SKIPPED :warning: integration-community.aws-10 SKIPPED :warning: integration-community.aws-11 SKIPPED :warning: integration-community.aws-12 SKIPPED :warning: integration-community.aws-13 SKIPPED

Build succeeded.

:heavy_check_mark: ansible-galaxy-importer SUCCESS in 5m 31s :heavy_check_mark: build-ansible-collection SUCCESS in 5m 15s :heavy_check_mark: ansible-test-sanity-docker-devel SUCCESS in 10m 29s (non-voting) :heavy_check_mark: ansible-test-sanity-docker-milestone SUCCESS in 9m 04s :heavy_check_mark: ansible-test-sanity-docker-stable-2.12 SUCCESS in 11m 14s :heavy_check_mark: ansible-test-sanity-docker-stable-2.13 SUCCESS in 9m 58s :heavy_check_mark: ansible-test-units-community-aws-python38 SUCCESS in 6m 22s :heavy_check_mark: ansible-test-units-community-aws-python39 SUCCESS in 5m 56s :heavy_check_mark: ansible-test-splitter SUCCESS in 2m 28s :warning: integration-community.aws-1 SKIPPED :warning: integration-community.aws-2 SKIPPED :warning: integration-community.aws-3 SKIPPED :warning: integration-community.aws-4 SKIPPED :warning: integration-community.aws-5 SKIPPED :warning: integration-community.aws-6 SKIPPED :warning: integration-community.aws-7 SKIPPED :warning: integration-community.aws-8 SKIPPED :warning: integration-community.aws-9 SKIPPED :warning: integration-community.aws-10 SKIPPED :warning: integration-community.aws-11 SKIPPED :warning: integration-community.aws-12 SKIPPED :warning: integration-community.aws-13 SKIPPED

Build succeeded.

:heavy_check_mark: ansible-galaxy-importer SUCCESS in 4m 28s :heavy_check_mark: build-ansible-collection SUCCESS in 5m 24s :heavy_check_mark: ansible-test-sanity-docker-devel SUCCESS in 11m 12s (non-voting) :heavy_check_mark: ansible-test-sanity-docker-milestone SUCCESS in 13m 07s :heavy_check_mark: ansible-test-sanity-docker-stable-2.12 SUCCESS in 10m 05s :heavy_check_mark: ansible-test-sanity-docker-stable-2.13 SUCCESS in 9m 59s :heavy_check_mark: ansible-test-units-community-aws-python38 SUCCESS in 6m 03s :heavy_check_mark: ansible-test-units-community-aws-python39 SUCCESS in 6m 40s :heavy_check_mark: ansible-test-splitter SUCCESS in 2m 34s :warning: integration-community.aws-1 SKIPPED :warning: integration-community.aws-2 SKIPPED :warning: integration-community.aws-3 SKIPPED :warning: integration-community.aws-4 SKIPPED :warning: integration-community.aws-5 SKIPPED :warning: integration-community.aws-6 SKIPPED :warning: integration-community.aws-7 SKIPPED :warning: integration-community.aws-8 SKIPPED :warning: integration-community.aws-9 SKIPPED :warning: integration-community.aws-10 SKIPPED :warning: integration-community.aws-11 SKIPPED :warning: integration-community.aws-12 SKIPPED :warning: integration-community.aws-13 SKIPPED :warning: integration-community.aws-14 SKIPPED :warning: integration-community.aws-15 SKIPPED :warning: integration-community.aws-16 SKIPPED :warning: integration-community.aws-17 SKIPPED :warning: integration-community.aws-18 SKIPPED

cc @jillr @markuman @s-hertel @tremble

phene avatar Sep 21 '22 17:09 phene

Bump

phene avatar Oct 17 '22 19:10 phene

Docs Build 📝

Thank you for contribution!✨

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

github-actions[bot] avatar Oct 18 '22 13:10 github-actions[bot]

Build succeeded.

:heavy_check_mark: ansible-galaxy-importer SUCCESS in 4m 11s :heavy_check_mark: build-ansible-collection SUCCESS in 4m 54s :x: ansible-test-sanity-docker-devel FAILURE in 8m 04s (non-voting) :heavy_check_mark: ansible-test-sanity-docker-milestone SUCCESS in 9m 57s :heavy_check_mark: ansible-test-sanity-docker-stable-2.12 SUCCESS in 9m 27s :heavy_check_mark: ansible-test-sanity-docker-stable-2.13 SUCCESS in 10m 15s :x: ansible-test-sanity-docker-stable-2.14 FAILURE in 8m 14s (non-voting) :heavy_check_mark: ansible-test-units-amazon-aws-python36 SUCCESS in 6m 38s :heavy_check_mark: ansible-test-units-amazon-aws-python38 SUCCESS in 5m 47s :heavy_check_mark: ansible-test-units-amazon-aws-python39 SUCCESS in 6m 08s :heavy_check_mark: ansible-test-splitter SUCCESS in 2m 36s :warning: integration-community.aws-1 SKIPPED :warning: integration-community.aws-2 SKIPPED :warning: integration-community.aws-3 SKIPPED :warning: integration-community.aws-4 SKIPPED :warning: integration-community.aws-5 SKIPPED :warning: integration-community.aws-6 SKIPPED :warning: integration-community.aws-7 SKIPPED :warning: integration-community.aws-8 SKIPPED :warning: integration-community.aws-9 SKIPPED :warning: integration-community.aws-10 SKIPPED :warning: integration-community.aws-11 SKIPPED :warning: integration-community.aws-12 SKIPPED :warning: integration-community.aws-13 SKIPPED :warning: integration-community.aws-14 SKIPPED :warning: integration-community.aws-15 SKIPPED :warning: integration-community.aws-16 SKIPPED :warning: integration-community.aws-17 SKIPPED :warning: integration-community.aws-18 SKIPPED :heavy_check_mark: ansible-test-changelog SUCCESS in 2m 34s

Build succeeded (gate pipeline).

:heavy_check_mark: ansible-galaxy-importer SUCCESS in 4m 12s :heavy_check_mark: build-ansible-collection SUCCESS in 4m 55s :x: ansible-test-sanity-docker-devel FAILURE in 9m 02s (non-voting) :heavy_check_mark: ansible-test-sanity-docker-milestone SUCCESS in 9m 32s :heavy_check_mark: ansible-test-sanity-docker-stable-2.12 SUCCESS in 10m 32s :heavy_check_mark: ansible-test-sanity-docker-stable-2.13 SUCCESS in 9m 32s :x: ansible-test-sanity-docker-stable-2.14 FAILURE in 8m 49s (non-voting) :heavy_check_mark: ansible-test-units-amazon-aws-python36 SUCCESS in 6m 05s :heavy_check_mark: ansible-test-units-amazon-aws-python38 SUCCESS in 5m 47s :heavy_check_mark: ansible-test-units-amazon-aws-python39 SUCCESS in 5m 48s :heavy_check_mark: ansible-test-splitter SUCCESS in 2m 34s :warning: integration-community.aws-1 SKIPPED :warning: integration-community.aws-2 SKIPPED :warning: integration-community.aws-3 SKIPPED :warning: integration-community.aws-4 SKIPPED :warning: integration-community.aws-5 SKIPPED :warning: integration-community.aws-6 SKIPPED :warning: integration-community.aws-7 SKIPPED :warning: integration-community.aws-8 SKIPPED :warning: integration-community.aws-9 SKIPPED :warning: integration-community.aws-10 SKIPPED :warning: integration-community.aws-11 SKIPPED :warning: integration-community.aws-12 SKIPPED :warning: integration-community.aws-13 SKIPPED :warning: integration-community.aws-14 SKIPPED :warning: integration-community.aws-15 SKIPPED :warning: integration-community.aws-16 SKIPPED :warning: integration-community.aws-17 SKIPPED :warning: integration-community.aws-18 SKIPPED :heavy_check_mark: ansible-test-changelog SUCCESS in 2m 16s

Backport to stable-4: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-4/fa58965fceb8613d734242e552313199892c96d1/pr-1428

Backported as https://github.com/ansible-collections/community.aws/pull/1563

🤖 @patchback I'm built with octomachinery and my source is open — https://github.com/sanitizers/patchback-github-app.

patchback[bot] avatar Oct 18 '22 13:10 patchback[bot]

Backport to stable-5: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-5/fa58965fceb8613d734242e552313199892c96d1/pr-1428

Backported as https://github.com/ansible-collections/community.aws/pull/1564

🤖 @patchback I'm built with octomachinery and my source is open — https://github.com/sanitizers/patchback-github-app.

patchback[bot] avatar Oct 18 '22 13:10 patchback[bot]