|
6 | 6 | from msrest.exceptions import ValidationError |
7 | 7 | from knack.log import get_logger |
8 | 8 | 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 |
10 | 10 | from ._utils import ( |
11 | 11 | get_registry_by_name, |
12 | 12 | validate_managed_registry, |
@@ -88,20 +88,12 @@ def acr_agentpool_delete(cmd, |
88 | 88 | user_confirmation("Are you sure you want to delete the agentpool '{}' in registry '{}'?".format( |
89 | 89 | agent_pool_name, registry_name), yes) |
90 | 90 | 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() |
94 | 92 |
|
95 | 93 | if no_wait: |
96 | 94 | logger.warning("Started to delete the agent pool '%s': %s", agent_pool_name, response.status()) |
97 | 95 | return response |
98 | 96 |
|
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) |
105 | 97 | except ValidationError as e: |
106 | 98 | raise CLIError(e) |
107 | 99 |
|
|
0 commit comments