Skip to content

Commit

Permalink
Merge pull request iterative#1812 from AmitAronovitch/azure_sas_fails
Browse files Browse the repository at this point in the history
azure: do not create existing container
  • Loading branch information
efiop authored Mar 31, 2019
2 parents b3addbd + 00b8144 commit 4904209
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion dvc/remote/azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

try:
from azure.storage.blob import BlockBlobService
from azure.common import AzureMissingResourceHttpError
except ImportError:
BlockBlobService = None

Expand Down Expand Up @@ -77,7 +78,12 @@ def blob_service(self):
connection_string=self.connection_string
)
logger.debug("Container name {}".format(self.bucket))
self.__blob_service.create_container(self.bucket)
try: # verify that container exists
self.__blob_service.list_blobs(
self.bucket, delimiter="/", num_results=1
)
except AzureMissingResourceHttpError:
self.__blob_service.create_container(self.bucket)
return self.__blob_service

def remove(self, path_info):
Expand Down

0 comments on commit 4904209

Please sign in to comment.