shahar1 commented on code in PR #61654:
URL: https://github.com/apache/airflow/pull/61654#discussion_r2812399650
##########
providers/google/src/airflow/providers/google/cloud/secrets/secret_manager.py:
##########
@@ -136,6 +136,13 @@ def __init__(
if project_id:
self.project_id = project_id
+ if not self.project_id:
+ raise AirflowException(
+ "Project ID could not be determined. "
+ "Please provide 'project_id' in backend configuration or
ensure "
+ "your credentials include a default project."
+ )
Review Comment:
Please change to another type of exception, preferrably a Python-native one
(like `ValueError`) - we try to avoid and reduce usage of `AirflowException`
within the codebase.
##########
providers/google/src/airflow/providers/google/cloud/utils/credentials_provider.py:
##########
@@ -418,10 +418,7 @@ def _get_credentials_using_adc(self) -> tuple[Credentials,
str]:
scopes = list(self.scopes) if self.scopes else None
credentials, project_id = google.auth.default(scopes=scopes)
if not project_id:
- raise AirflowException(
- "Project ID could not be determined from default credentials. "
- "Please provide `key_secret_project_id` parameter."
- )
Review Comment:
I was curious why you didn't have to remove/update related tests accordingly
-
after a short research I've found that it was implemented to appease mypy
as part of https://github.com/apache/airflow/pull/60146
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]