mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
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:
co-authored by
Ruslan Kuprieiev
Matt Hollingsworth
Matt Hollingsworth
Restyled.io
parent
ece7d6ba67
commit
ebaffd728e
+8
-1
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user