Skip to content

Commit

Permalink
Use HeadBucket instead of GetBucketLocation (ansible-collections#1979)
Browse files Browse the repository at this point in the history
  • Loading branch information
raulpedroche committed Oct 25, 2023
1 parent 9c85fec commit ddb05fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugins/connection/aws_ssm.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,10 +404,10 @@ def _get_bucket_endpoint(self):
)
# Fetch the location of the bucket so we can open a client against the 'right' endpoint
# This /should/ always work
bucket_location = tmp_s3_client.get_bucket_location(
head_bucket = tmp_s3_client.head_bucket(
Bucket=(self.get_option("bucket_name")),
)
bucket_region = bucket_location["LocationConstraint"]
bucket_region = head_bucket["ResponseMetadata"]["HTTPHeaders"]["x-amz-bucket-region"]

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

0 comments on commit ddb05fe

Please sign in to comment.