Skip to content

Commit a1b03cc

Browse files
committed
Fix delete pending flag as file/dir not exists
1 parent f1c087e commit a1b03cc

File tree

1 file changed

+8
-0
lines changed
  • src/azure-cli/azure/cli/command_modules/storage/operations

1 file changed

+8
-0
lines changed

src/azure-cli/azure/cli/command_modules/storage/operations/fileshare.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,18 @@ def _get_client(client, kwargs):
119119
dir_client = client.get_directory_client(directory_path=total_path)
120120
exists = False
121121
from azure.core.exceptions import ClientAuthenticationError
122+
from azure.core.exceptions import ResourceExistsError
122123
try:
123124
exists = dir_client.exists()
124125
except ClientAuthenticationError:
125126
exists = False
127+
except ResourceExistsError as ex:
128+
if hasattr(ex, "error_code") and ex.error_code == "DeletePending":
129+
# translate delete pending flag as file/dir not exists.
130+
exists = False
131+
else:
132+
raise ex
133+
126134
if not exists:
127135
dir_client = client.get_directory_client(directory_path=directory_path)
128136
client = dir_client.get_file_client(file_name=file_name)

0 commit comments

Comments
 (0)