Skip to content

Commit 6e65cf8

Browse files
committed
fix: explicitly wait for LRO in enable-addons and disable-addons
aks enable-addons and aks disable-addons were returning the LRO poller from sdk_no_wait without explicitly waiting for completion. When the server-side operation takes longer, the initial response returns provisioningState 'Updating' instead of 'Succeeded'. Fix by using LongRunningOperation to explicitly wait when no_wait is not set, matching the pattern used in put_mc and the need_post_creation_role_assignment path.
1 parent 027abe3 commit 6e65cf8

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/aks-preview/azext_aks_preview/custom.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3032,7 +3032,10 @@ def aks_disable_addons(cmd, client, resource_group_name, name, addons, no_wait=F
30323032
)
30333033

30343034
# send the managed cluster representation to update the addon profiles
3035-
return sdk_no_wait(no_wait, client.begin_create_or_update, resource_group_name, name, instance)
3035+
if no_wait:
3036+
return sdk_no_wait(True, client.begin_create_or_update, resource_group_name, name, instance)
3037+
return LongRunningOperation(cmd.cli_ctx)(
3038+
client.begin_create_or_update(resource_group_name, name, instance))
30363039

30373040

30383041
def aks_enable_addons(
@@ -3189,8 +3192,12 @@ def aks_enable_addons(
31893192
# we don't need to handle it in client side in this case.
31903193

31913194
else:
3192-
result = sdk_no_wait(no_wait, client.begin_create_or_update,
3193-
resource_group_name, name, instance, headers=headers)
3195+
if no_wait:
3196+
result = sdk_no_wait(True, client.begin_create_or_update,
3197+
resource_group_name, name, instance, headers=headers)
3198+
else:
3199+
result = LongRunningOperation(cmd.cli_ctx)(
3200+
client.begin_create_or_update(resource_group_name, name, instance, headers=headers))
31943201
return result
31953202

31963203

0 commit comments

Comments
 (0)