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/01/06 04:10:55 UTC
[GitHub] [airflow] uranusjr commented on a change in pull request #20510: Add SAS check before attempting container creation when uploading files via WasbHook
uranusjr commented on a change in pull request #20510:
URL: https://github.com/apache/airflow/pull/20510#discussion_r779287904
##########
File path: airflow/providers/microsoft/azure/hooks/wasb.py
##########
@@ -136,11 +137,19 @@ def get_conn(self) -> BlobServiceClient:
tenant = extra.get('tenant_id', extra.get('extra__wasb__tenant_id'))
token_credential = ClientSecretCredential(tenant, app_id, app_secret)
return BlobServiceClient(account_url=conn.host, credential=token_credential)
+
sas_token = extra.get('sas_token') or extra.get('extra__wasb__sas_token')
- if sas_token and sas_token.startswith('https'):
- return BlobServiceClient(account_url=sas_token)
- if sas_token and not sas_token.startswith('https'):
- return BlobServiceClient(account_url=f"https://{conn.login}.blob.core.windows.net/" + sas_token)
+ if sas_token:
+ allows_container_create = self._check_sas_allows_container_creation(sas=sas_token)
+ if not allows_container_create:
+ self.attempt_container_creation = False
+
+ if sas_token.startswith('https'):
+ return BlobServiceClient(account_url=sas_token)
+ else:
+ return BlobServiceClient(
+ account_url=f'https://{conn.login}.blob.core.windows.net/' + sas_token
Review comment:
```suggestion
account_url=f'https://{conn.login}.blob.core.windows.net/{sas_token}'
```
--
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