mik-laj commented on a change in pull request #5907: [AIRFLOW-5303] Use
project_id from GCP credentials
URL: https://github.com/apache/airflow/pull/5907#discussion_r319260895
##########
File path: airflow/contrib/hooks/gcp_api_base_hook.py
##########
@@ -125,11 +125,25 @@ def _get_credentials(self) ->
google.auth.credentials.Credentials:
google.oauth2.service_account.Credentials.from_service_account_info(
keyfile_dict_json, scopes=self.scopes)
)
+ project_id = credentials.project_id
except json.decoder.JSONDecodeError:
raise AirflowException('Invalid key JSON.')
- return credentials.with_subject(self.delegate_to) \
- if self.delegate_to else credentials
+ if self.delegate_to:
+ credentials = credentials.with_subject(self.delegate_to)
+
+ overridden_project_id = self._get_field('project')
Review comment:
I added a 8 tests. I am testing a lot of different cases now.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services