@@ -1780,7 +1780,7 @@ def aks_agentpool_get_upgrade_profile(cmd, # pylint: disable=unused-argument
17801780def aks_agentpool_get_rollback_versions (cmd , # pylint: disable=unused-argument
17811781 client ,
17821782 resource_group_name ,
1783- cluster_name ,
1783+ cluster_name ,
17841784 nodepool_name ):
17851785 """Get rollback versions for a nodepool."""
17861786 upgrade_profile = client .get_upgrade_profile (resource_group_name , cluster_name , nodepool_name )
@@ -1799,36 +1799,36 @@ def aks_agentpool_rollback(cmd, # pylint: disable=unused-argument
17991799 if_none_match = None ,
18001800 no_wait = False ):
18011801 """Rollback a nodepool to N-1 (previously used configuration)."""
1802-
1802+
18031803 # Get the current agent pool
18041804 current_agentpool = client .get (resource_group_name , cluster_name , nodepool_name )
1805-
1805+
18061806 # Get upgrade profile to get recently used versions
18071807 upgrade_profile = client .get_upgrade_profile (resource_group_name , cluster_name , nodepool_name )
1808-
1808+
18091809 # Check if rollback versions are available
18101810 if not upgrade_profile .recently_used_versions :
18111811 raise CLIError ("No rollback versions are available for this nodepool." )
1812-
1812+
18131813 # If no specific versions are provided, use the most recent (N-1) version
18141814 if not kubernetes_version and not node_image_version :
18151815 most_recent = upgrade_profile .recently_used_versions [0 ]
18161816 kubernetes_version = most_recent .orchestrator_version
18171817 node_image_version = most_recent .node_image_version
1818-
1818+
18191819 # Update the agent pool configuration with rollback versions
18201820 if kubernetes_version :
18211821 current_agentpool .orchestrator_version = kubernetes_version
18221822 if node_image_version :
18231823 current_agentpool .node_image_version = node_image_version
1824-
1824+
18251825 # Set custom headers if provided
18261826 headers = get_aks_custom_headers (aks_custom_headers )
18271827 if if_match :
18281828 headers ['If-Match' ] = if_match
18291829 if if_none_match :
18301830 headers ['If-None-Match' ] = if_none_match
1831-
1831+
18321832 # Perform the rollback by updating the agent pool
18331833 # Server-side will validate the versions
18341834 return sdk_no_wait (
0 commit comments