Skip to content

Commit

Permalink
Update providers.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-mosleh authored Nov 20, 2024
1 parent b048920 commit 759a5f3
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions minio/credentials/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,18 +508,13 @@ def retrieve(self) -> Credentials:
res = _urlopen(
self._http_client,
"GET",
urlunsplit(
url_replace(
urlsplit(url),
path="/latest/meta-data/iam/security-credentials/",
),
),
url+"/latest/meta-data/iam/security-credentials/",
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 += "/latest/meta-data/iam/security-credentials/" + 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 759a5f3

Please sign in to comment.