gazev commented on code in PR #39873:
URL: https://github.com/apache/airflow/pull/39873#discussion_r1627502100


##########
airflow/providers/google/cloud/utils/credentials_provider.py:
##########
@@ -419,3 +452,18 @@ def 
_get_project_id_from_service_account_email(service_account_email: str) -> st
         raise AirflowException(
             f"Could not extract project_id from service account's email: 
{service_account_email}."
         )
+
+
+def 
_get_info_from_credential_configuration_file(credential_configuration_file):
+    if isinstance(credential_configuration_file, str) and 
os.path.exists(credential_configuration_file):
+        with open(credential_configuration_file) as file_obj:
+            try:
+                info = json.load(file_obj)
+            except ValueError:
+                raise AirflowException("Credentials Configuration File is not 
a valid json file.")
+    else:
+        try:
+            info = json.loads(credential_configuration_file)
+        except json.decoder.JSONDecodeError:
+            raise AirflowException("Invalid JSON.")

Review Comment:
   Thank you for the heads up, the function logic seems to be incorrect. I have 
fixed it and we will soon be adding unit tests as well. Let me know if it looks 
better 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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to