From ebaffd728eb55a7d52293383175790b81263f3ab Mon Sep 17 00:00:00 2001 From: "restyled-io[bot]" <32688539+restyled-io[bot]@users.noreply.github.com> Date: Tue, 22 Sep 2020 00:07:56 +0300 Subject: [PATCH] Restyle Do not require account-level permissions for Azure tree (#4583) * Do not require account-level permissions for Azure tree * Only allow the existence check to pass without error if it failed due to authorization issues * Update dvc/tree/azure.py Co-authored-by: Ruslan Kuprieiev * Update dvc/tree/azure.py Co-authored-by: Ruslan Kuprieiev * Restyled by isort * Update azure.py Co-authored-by: Matt Hollingsworth Co-authored-by: Matt Hollingsworth Co-authored-by: Ruslan Kuprieiev Co-authored-by: Restyled.io --- dvc/tree/azure.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dvc/tree/azure.py b/dvc/tree/azure.py index 1aaa16b7a..3a14aac33 100644 --- a/dvc/tree/azure.py +++ b/dvc/tree/azure.py @@ -67,7 +67,10 @@ class AzureTree(BaseTree): @cached_property def blob_service(self): # pylint: disable=no-name-in-module - from azure.core.exceptions import ResourceNotFoundError + from azure.core.exceptions import ( + HttpResponseError, + ResourceNotFoundError, + ) from azure.storage.blob import BlobServiceClient logger.debug(f"URL {self.path_info}") @@ -92,6 +95,10 @@ class AzureTree(BaseTree): container_client.get_container_properties() except ResourceNotFoundError: container_client.create_container() + except HttpResponseError as exc: + # client may not have account-level privileges + if exc.status_code != 403: + raise return blob_service