Skip to content
This repository was archived by the owner on Nov 1, 2023. It is now read-only.

Commit 60ae07c

Browse files
authored
handle azure-storage deleting nonexistent containers (#948)
1 parent 74c0e0a commit 60ae07c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/api-service/__app__/onefuzzlib/azure/containers.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from typing import Dict, Optional, Union, cast
1111

1212
from azure.common import AzureHttpError, AzureMissingResourceHttpError
13-
from azure.core.exceptions import ResourceExistsError
13+
from azure.core.exceptions import ResourceExistsError, ResourceNotFoundError
1414
from azure.storage.blob import (
1515
BlobClient,
1616
BlobSasPermissions,
@@ -146,12 +146,16 @@ def create_container(
146146

147147
def delete_container(container: Container, storage_type: StorageType) -> bool:
148148
accounts = get_accounts(storage_type)
149+
deleted = False
149150
for account in accounts:
150151
service = get_blob_service(account)
151-
if bool(service.delete_container(container)):
152-
return True
152+
try:
153+
service.delete_container(container)
154+
deleted = True
155+
except ResourceNotFoundError:
156+
pass
153157

154-
return False
158+
return deleted
155159

156160

157161
def get_container_sas_url_service(

0 commit comments

Comments
 (0)