Skip to content

Commit

Permalink
IamAwsProvider: fix url with role name
Browse files Browse the repository at this point in the history
Fixes #1459

Signed-off-by: Bala.FA <[email protected]>
  • Loading branch information
balamurugana committed Dec 6, 2024
1 parent a7b443d commit 15d7fa0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13.0"]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
Expand Down
16 changes: 6 additions & 10 deletions minio/credentials/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,21 +505,17 @@ def retrieve(self) -> Credentials:
headers = {"X-aws-ec2-metadata-token": token} if token else None

# Get role name
res = _urlopen(
self._http_client,
"GET",
urlunsplit(
url_replace(
urlsplit(url),
path="/latest/meta-data/iam/security-credentials/",
),
url = urlunsplit(
url_replace(
urlsplit(url),
path="/latest/meta-data/iam/security-credentials/",
),
headers=headers,
)
res = _urlopen(self._http_client, "GET", url, headers=headers)
role_names = res.data.decode("utf-8").split("\n")
if not role_names:
raise ValueError(f"no IAM roles attached to EC2 service {url}")
url += "/" + role_names[0].strip("\r")
url += role_names[0].strip("\r")
if not url:
raise ValueError("url is empty; this should not happen")
self._credentials = self.fetch(url, headers=headers)
Expand Down

0 comments on commit 15d7fa0

Please sign in to comment.