Skip to content

Commit

Permalink
Remove support to get the default from instance metadata
Browse files Browse the repository at this point in the history
Signed-off-by: Mattia Bertorello <mattia.bertorello@booking.com>
  • Loading branch information
mattiabertorello committed Mar 1, 2024
1 parent d925acb commit 5e4ff54
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions client/python/openlineage/client/transport/msk_iam.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,12 @@ def _detect_running_region() -> None | str:
boto3.DEFAULT_SESSION.region_name if boto3.DEFAULT_SESSION else None,
boto3.Session().region_name,
]
region: None | str = None
region: str
for region in easy_checks:
if region:
return region

# else query an external service
# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-identity-documents.html
import requests

try:
r = requests.get("http://169.254.169.254/latest/dynamic/instance-identity/document", timeout=1)
region = r.json().get("region")
except Exception: # noqa: S110 BLE001
pass

return region
return None


@attr.s
Expand Down

0 comments on commit 5e4ff54

Please sign in to comment.