Skip to content

Commit

Permalink
fix(connection): get bucket_region in aws_ssm (#1908) (#2043)
Browse files Browse the repository at this point in the history
[PR #1908/5224601b backport][stable-7] fix(connection): get bucket_region in aws_ssm

This is a backport of PR #1908 as merged into main (5224601).
SUMMARY
when bucket is in us-east-1,
bucket_location["LocationConstraint"] is null
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
connection
ADDITIONAL INFORMATION
add condition for bucket_region

Reviewed-by: Mark Chappell
  • Loading branch information
patchback[bot] authored Jan 11, 2024
1 parent cfb9ee6 commit c47f068
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- ssm(connection) - fix bucket region logic when region is ``us-east-1`` (https://github.com/ansible-collections/community.aws/pull/1908)
5 changes: 4 additions & 1 deletion plugins/connection/aws_ssm.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,10 @@ def _get_bucket_endpoint(self):
bucket_location = tmp_s3_client.get_bucket_location(
Bucket=(self.get_option("bucket_name")),
)
bucket_region = bucket_location["LocationConstraint"]
if bucket_location["LocationConstraint"]:
bucket_region = bucket_location["LocationConstraint"]
else:
bucket_region = "us-east-1"

if self.get_option("bucket_endpoint_url"):
return self.get_option("bucket_endpoint_url"), bucket_region
Expand Down

0 comments on commit c47f068

Please sign in to comment.