From 2e5d424fffec6e9b982811647a51bf2cc1cb675f Mon Sep 17 00:00:00 2001 From: RakeshMohan-MSFT <49954584+RakeshMohanMSFT@users.noreply.github.com> Date: Fri, 12 Aug 2022 10:01:54 +0530 Subject: [PATCH] {servicefabric} Fix #16717: Validate an empty array of node types Fix https://github.com/Azure/azure-cli/issues/16717. Though the bug is not directly related to the issue, while debugging this issue surfaces while giving wrong node type as parameter. --- src/azure-cli/azure/cli/command_modules/servicefabric/custom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/servicefabric/custom.py b/src/azure-cli/azure/cli/command_modules/servicefabric/custom.py index de1e70707bd..44321fd3656 100644 --- a/src/azure-cli/azure/cli/command_modules/servicefabric/custom.py +++ b/src/azure-cli/azure/cli/command_modules/servicefabric/custom.py @@ -487,7 +487,7 @@ def remove_cluster_node(cmd, client, resource_group_name, cluster_name, node_typ compute_client = compute_client_factory(cli_ctx) cluster = client.get(resource_group_name, cluster_name) node_types = [n for n in cluster.node_types if n.name.lower() == node_type.lower()] - if node_types is None: + if node_types is None or len(node_types) == 0: raise CLIError("Failed to find the node type in the cluster") node_type = node_types[0]