You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/03/03 21:09:20 UTC

[GitHub] [airflow] TreyYi commented on issue #21940: Google Ads Hook broken for Composer 2 (and presumably others)

TreyYi commented on issue #21940:
URL: https://github.com/apache/airflow/issues/21940#issuecomment-1058497488


   I understand that "path_to_private_key_file" is not required since Cloud Composer 2 is implemented to use Workload Identity which is pre-configured by GCP, but still there could be a chance of using it in Cloud Composer 1 with Standard mode.
   
   @potiuk @akerone , would you mind provide some ideas of how to implement ads.py? 
   I was trying to add if statement like below but "extra__google_cloud_platform__keyfile_dict" is needed for Cloud Composer 1 with Standard mode.
   ```
       def _update_config_with_secret(self, secrets_temp: IO[str]) -> None:
           """
           Gets Google Cloud secret from connection and saves the contents to the temp file
           Updates google ads config with file path of the temp file containing the secret.
           Note, the secret is optional in extra since Cloud Composer 2 does not require path_to_private_key_file.
           (Workload Identity is used instead of Service Account)
           """
           secret_conn = self.get_connection(self.gcp_conn_id)
           
           if "extra__google_cloud_platform__keyfile_dict" in secret_conn.extra_dejson:
               secret = secret_conn.extra_dejson["extra__google_cloud_platform__keyfile_dict"]
               secrets_temp.write(secret)
               secrets_temp.flush()
   
               self.google_ads_config["path_to_private_key_file"] = secrets_temp.name
   ```
   
   Also, I am wondering how to distinguish whether GCP users use Composer 1 or 2..


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org