MaksYermak commented on code in PR #23773:
URL: https://github.com/apache/airflow/pull/23773#discussion_r877200249
##########
airflow/providers/google/cloud/utils/credentials_provider.py:
##########
@@ -248,6 +250,16 @@ def get_credentials_and_project(self) ->
Tuple[google.auth.credentials.Credentia
project_id =
_get_project_id_from_service_account_email(self.target_principal)
+ if isinstance(credentials, compute_engine.Credentials):
+ try:
+ credentials.refresh(_http_client.Request())
+ except RefreshError as msg:
+ """
+ If the Compute Engine metadata service can't be reached in
this case the instance has not
+ credentials.
+ """
+ self._log_debug(msg)
Review Comment:
@kosteev yes you are right, I have wanted to return the best-effort approach
which had been before I added this change.
I have noticed that when the breeze is started with --db-reset flag, under
the hood it takes credentials and returns a compute_engine object. But the
breeze is not run inside the Compute Engine and when this code tries to refresh
credentials we see the 404 error. And this 404 error breaks the all breeze
start process. It is a reason why I have decided to add a try-catch part and
left the credentials object in the default state. I am not sure that it is a
good solution, but I do not see others. Maybe you know, how is it better to
handle this error?
--
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]