-
Notifications
You must be signed in to change notification settings - Fork 10
fix: preflight error logging #789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,7 @@ | |
| logger = get_logger(__name__) | ||
|
|
||
|
|
||
| def get_region_name_from_hostname(hostname: str) -> str: | ||
| def get_region_name_from_hostname(hostname: str) -> str | None: | ||
| """ | ||
| Extract region name from AWS RDS endpoint. | ||
| Example: database-1.abc123xyz.us-east-1.rds.amazonaws.com -> us-east-1 | ||
|
|
@@ -28,7 +28,8 @@ def get_region_name_from_hostname(hostname: str) -> str: | |
| match = re.search(r"-([a-z]{2}-[a-z]+-\d)\.", hostname) | ||
| if match: | ||
| return match.group(1) | ||
| raise ValueError("Could not find valid AWS region from hostname") | ||
| logger.warning("Could not find valid AWS region from hostname") | ||
| return None | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Returning
|
||
|
|
||
|
|
||
| def generate_aws_rds_token_with_iam_role( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Calling
.get()on potentiallyNoneresultWhen
resultisNone(or another falsy value), the code attempts to callresult.get("error", "")which raises anAttributeErrorsinceNonedoesn't have a.get()method. The conditionif not result or "error" in resultshort-circuits and enters theifblock whenresultis falsy, but then tries to access.get()on that falsy value.