Skip to content

Commit

Permalink
Fixed ambiguous error message raised when resolving region from IMDS
Browse files Browse the repository at this point in the history
  • Loading branch information
nateprewitt committed Nov 13, 2024
1 parent d67663a commit d627f04
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changes/next-release/bugfix-IMDS-70100.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "bugfix",
"category": "IMDS",
"description": "Fixed ambiguous error raised when failing to resolve a region from IMDS."
}
14 changes: 11 additions & 3 deletions awscli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,17 @@ def retrieve_region(self):
region = self._get_region()
return region
except self._RETRIES_EXCEEDED_ERROR_CLS:
logger.debug("Max number of attempts exceeded (%s) when "
"attempting to retrieve data from metadata service.",
self._num_attempts)
logger.debug(
"Max number of attempts exceeded (%s) when "
"attempting to retrieve data from metadata service.",
self._num_attempts
)
except BadIMDSRequestError as e:
logger.debug(
"Failed to retrieve a region from IMDS. "
"Region detection may not be supported from this endpoint: "
"%s", e.request.url
)
return None

def _get_region(self):
Expand Down

0 comments on commit d627f04

Please sign in to comment.