Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/azure-cli-core/azure/cli/core/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@ def _generate_template_progress(self, correlation_id): # pylint: disable=no-sel

def __call__(self, poller):
from msrest.exceptions import ClientException
from azure.core.exceptions import HttpResponseError

correlation_message = ''
self.progress_bar.begin()
Expand Down Expand Up @@ -984,14 +985,18 @@ def __call__(self, poller):

try:
result = poller.result()
except ClientException as client_exception:
except (ClientException, HttpResponseError) as exception:
from azure.cli.core.commands.arm import handle_long_running_operation_exception
self.progress_bar.stop()
if getattr(client_exception, 'status_code', None) == 404 and 'delete' in self.cli_ctx.data['command']:
logger.debug('Service returned 404 on the long-running delete operation. CLI treats it as delete '
'successfully but service should fix this behavior.')
if getattr(exception, 'status_code', None) == 404 and \
('delete' in self.cli_ctx.data['command'] or 'purge' in self.cli_ctx.data['command']):
logger.debug('Service returned 404 on the long-running delete or purge operation. CLI treats it as '
'delete or purge successfully but service should fix this behavior.')
return None
handle_long_running_operation_exception(client_exception)
if isinstance(exception, ClientException):
handle_long_running_operation_exception(exception)
else:
raise exception
finally:
self.progress_bar.end()
if poll_flag:
Expand Down