From cebb84b9e7681c28a827f72d3638054cf5bcf4da Mon Sep 17 00:00:00 2001 From: bmc-msft <41130664+bmc-msft@users.noreply.github.com> Date: Sun, 21 Feb 2021 20:49:07 -0500 Subject: [PATCH] handle error condition when creating a container that is being deleted (#582) When users try to create a container immediately after deleting it, Azure will fail saying the deletion is in-progress. catching ResourceExistsError during create handles this error. --- src/api-service/__app__/onefuzzlib/azure/containers.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/api-service/__app__/onefuzzlib/azure/containers.py b/src/api-service/__app__/onefuzzlib/azure/containers.py index 539d31d82..8bc6cdb1d 100644 --- a/src/api-service/__app__/onefuzzlib/azure/containers.py +++ b/src/api-service/__app__/onefuzzlib/azure/containers.py @@ -10,7 +10,7 @@ import urllib.parse from typing import Dict, Optional, Union, cast from azure.common import AzureHttpError, AzureMissingResourceHttpError -from azure.core.exceptions import ResourceNotFoundError +from azure.core.exceptions import ResourceExistsError, ResourceNotFoundError from azure.storage.blob import ( BlobClient, BlobSasPermissions, @@ -123,7 +123,9 @@ def create_container( client = get_blob_service(account).get_container_client(container) try: client.create_container(metadata=metadata) - except AzureHttpError as err: + except (ResourceExistsError, AzureHttpError) as err: + # note: resource exists error happens during creation if the container + # is being deleted logging.error( ( "unable to create container. account: %s "