From 00b81445a994b53ff1de0c6aff14dd725a70cbaa Mon Sep 17 00:00:00 2001 From: Amit Aronovitch Date: Sun, 31 Mar 2019 11:39:39 +0300 Subject: [PATCH] azure: do not create existing container --- dvc/remote/azure.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dvc/remote/azure.py b/dvc/remote/azure.py index 740e57b3ea..99fbcef7b8 100644 --- a/dvc/remote/azure.py +++ b/dvc/remote/azure.py @@ -6,6 +6,7 @@ try: from azure.storage.blob import BlockBlobService + from azure.common import AzureMissingResourceHttpError except ImportError: BlockBlobService = None @@ -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):