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 <[email protected]>

* Update dvc/tree/azure.py

Co-authored-by: Ruslan Kuprieiev <[email protected]>

* Restyled by isort

* Update azure.py

Co-authored-by: Matt Hollingsworth <[email protected]>
Co-authored-by: Matt Hollingsworth <[email protected]>
Co-authored-by: Ruslan Kuprieiev <[email protected]>
Co-authored-by: Restyled.io <[email protected]>
This commit is contained in:
restyled-io[bot]
2020-09-22 00:07:56 +03:00
committed by GitHub
co-authored by Ruslan Kuprieiev Matt Hollingsworth Matt Hollingsworth Restyled.io
parent ece7d6ba67
commit ebaffd728e
+8 -1
View File
@@ -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