Skip to content

Commit 4e82c24

Browse files
author
wju
committed
use sdk_no_wait to fix agentpool polling
1 parent 30bf327 commit 4e82c24

File tree

2 files changed

+2010
-342
lines changed

2 files changed

+2010
-342
lines changed

src/azure-cli/azure/cli/command_modules/acr/agentpool.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from msrest.exceptions import ValidationError
77
from knack.log import get_logger
88
from knack.util import CLIError
9-
from azure.cli.core.util import user_confirmation
9+
from azure.cli.core.util import sdk_no_wait, user_confirmation
1010
from ._utils import (
1111
get_registry_by_name,
1212
validate_managed_registry,
@@ -88,20 +88,12 @@ def acr_agentpool_delete(cmd,
8888
user_confirmation("Are you sure you want to delete the agentpool '{}' in registry '{}'?".format(
8989
agent_pool_name, registry_name), yes)
9090
try:
91-
response = client.begin_delete(resource_group_name=resource_group_name,
92-
registry_name=registry_name,
93-
agent_pool_name=agent_pool_name)
91+
response = sdk_no_wait(no_wait, client.begin_delete, resource_group_name, registry_name, agent_pool_name).result()
9492

9593
if no_wait:
9694
logger.warning("Started to delete the agent pool '%s': %s", agent_pool_name, response.status())
9795
return response
9896

99-
# Since agent pool is a tracked resource in arm, arm also pings the async deletion api at the
100-
# same time to get the status. If arm gets the 200 status first and knows that the resource is deleted,
101-
# it marks the resource as deleted and stop routing further requests to the resource including the
102-
# async deletion status api. Hence arm will directly return 404. Consider this as successful delete.
103-
from ._agentpool_polling import delete_agentpool_with_polling
104-
return delete_agentpool_with_polling(cmd, client, agent_pool_name, registry_name, resource_group_name)
10597
except ValidationError as e:
10698
raise CLIError(e)
10799

0 commit comments

Comments
 (0)