Skip to content

Commit 938f3b5

Browse files
authored
{AKS} az aks delete: Fix linter failure for unrecognized --if-none-match help parameter (#9703)
1 parent 3a8265c commit 938f3b5

4 files changed

Lines changed: 41 additions & 1 deletion

File tree

src/aks-preview/azext_aks_preview/_help.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,25 @@
805805
806806
"""
807807

808+
helps['aks delete'] = """
809+
type: command
810+
short-summary: Delete a managed Kubernetes cluster.
811+
parameters:
812+
- name: --if-match
813+
type: string
814+
short-summary: The value provided will be compared to the ETag of the managed cluster, if it matches the operation will proceed. If it does not match, the request will be rejected to prevent accidental overwrites.
815+
- name: --if-none-match
816+
type: string
817+
short-summary: Not applicable for delete operations. This option will be ignored if provided.
818+
- name: --ignore-pod-disruption-budget
819+
type: bool
820+
short-summary: Delete those pods on a node without considering Pod Disruption Budget.
821+
examples:
822+
- name: Delete a managed Kubernetes cluster.
823+
text: az aks delete --name MyManagedCluster --resource-group MyResourceGroup
824+
crafted: true
825+
"""
826+
808827
helps['aks scale'] = """
809828
type: command
810829
short-summary: Scale the node pool in a managed Kubernetes cluster.

src/aks-preview/azext_aks_preview/_params.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,6 +1821,11 @@ def load_arguments(self, _):
18211821
help="Disable continuous control plane and addon monitor for the cluster.",
18221822
)
18231823

1824+
with self.argument_context("aks delete") as c:
1825+
c.argument("if_match")
1826+
c.argument("if_none_match")
1827+
c.argument("ignore_pod_disruption_budget", action="store_true")
1828+
18241829
with self.argument_context("aks upgrade") as c:
18251830
c.argument("kubernetes_version", completer=get_k8s_upgrades_completion_list)
18261831
c.argument(

src/aks-preview/azext_aks_preview/commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def load_command_table(self, _):
168168
)
169169
g.custom_command("upgrade", "aks_upgrade", supports_no_wait=True)
170170
g.custom_command("scale", "aks_scale", supports_no_wait=True)
171-
g.command("delete", "begin_delete", supports_no_wait=True, confirmation=True)
171+
g.custom_command("delete", "aks_delete", supports_no_wait=True, confirmation=True)
172172
g.custom_show_command(
173173
"show", "aks_show", table_transformer=aks_show_table_format
174174
)

src/aks-preview/azext_aks_preview/custom.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,6 +1445,22 @@ def aks_show(cmd, client, resource_group_name, name, aks_custom_headers=None):
14451445
return _remove_nulls([mc])[0]
14461446

14471447

1448+
def aks_delete(cmd, client, resource_group_name, name, no_wait=False,
1449+
if_match=None, if_none_match=None, ignore_pod_disruption_budget=None):
1450+
if if_none_match is not None:
1451+
logger.warning(
1452+
"The '--if-none-match' option is not applicable to delete operations and will be ignored."
1453+
)
1454+
return sdk_no_wait(
1455+
no_wait,
1456+
client.begin_delete,
1457+
resource_group_name,
1458+
name,
1459+
if_match=if_match,
1460+
ignore_pod_disruption_budget=ignore_pod_disruption_budget,
1461+
)
1462+
1463+
14481464
# pylint: disable=unused-argument
14491465
def aks_stop(cmd, client, resource_group_name, name, no_wait=False):
14501466
instance = client.get(resource_group_name, name)

0 commit comments

Comments
 (0)