From 91285ad13d19a98c2db37006b13acc5840cb99be Mon Sep 17 00:00:00 2001 From: FumingZhang <81607949+FumingZhang@users.noreply.github.com> Date: Fri, 13 May 2022 17:50:00 +0800 Subject: [PATCH] fix (#4810) --- src/aks-preview/HISTORY.rst | 4 ++++ .../azext_aks_preview/_completers.py | 21 ------------------- src/aks-preview/azext_aks_preview/_params.py | 7 ++----- src/aks-preview/setup.py | 2 +- 4 files changed, 7 insertions(+), 27 deletions(-) diff --git a/src/aks-preview/HISTORY.rst b/src/aks-preview/HISTORY.rst index c2c055cb49a..ac0ed0a0b57 100644 --- a/src/aks-preview/HISTORY.rst +++ b/src/aks-preview/HISTORY.rst @@ -12,6 +12,10 @@ To release a new version, please select a new version number (usually plus 1 to Pending +++++++ +0.5.69 +++++++ +* Fix: Raise error when user provides invalid value for `--os-sku`. + 0.5.68 ++++++ * Add option `Windows2019`, `Windows2022` to `--os-sku` for `az aks nodepool add`. diff --git a/src/aks-preview/azext_aks_preview/_completers.py b/src/aks-preview/azext_aks_preview/_completers.py index b9632c0b513..61194dc5547 100644 --- a/src/aks-preview/azext_aks_preview/_completers.py +++ b/src/aks-preview/azext_aks_preview/_completers.py @@ -8,13 +8,6 @@ from azext_aks_preview._client_factory import CUSTOM_MGMT_AKS_PREVIEW -from ._consts import ( - CONST_OS_SKU_UBUNTU, - CONST_OS_SKU_CBLMARINER, - CONST_OS_SKU_WINDOWS2019, - CONST_OS_SKU_WINDOWS2022, -) - @Completer def get_k8s_upgrades_completion_list(cmd, prefix, namespace, **kwargs): # pylint: disable=unused-argument @@ -69,20 +62,6 @@ def get_vm_sizes(cli_ctx, location): return cf_compute_service(cli_ctx).virtual_machine_sizes.list(location) -@Completer -def get_cluster_ossku_completion_list(cmd, prefix, namespace, **kwargs): # pylint: disable=unused-argument - """Return the list of allowed os-sku values when create cluster""" - - return [CONST_OS_SKU_UBUNTU, CONST_OS_SKU_CBLMARINER] - - -@Completer -def get_nodepool_ossku_completion_list(cmd, prefix, namespace, **kwargs): # pylint: disable=unused-argument - """Return the list of allowed os-sku values when add nodepool""" - - return [CONST_OS_SKU_UBUNTU, CONST_OS_SKU_CBLMARINER, CONST_OS_SKU_WINDOWS2019, CONST_OS_SKU_WINDOWS2022] - - def _get_location(cli_ctx, namespace): """ Return an Azure location by using an explicit `--location` argument, then by `--resource-group`, and diff --git a/src/aks-preview/azext_aks_preview/_params.py b/src/aks-preview/azext_aks_preview/_params.py index 26fcc194d52..abd581b3c8d 100644 --- a/src/aks-preview/azext_aks_preview/_params.py +++ b/src/aks-preview/azext_aks_preview/_params.py @@ -24,8 +24,6 @@ from ._completers import ( get_k8s_upgrades_completion_list, get_k8s_versions_completion_list, - get_cluster_ossku_completion_list, - get_nodepool_ossku_completion_list, get_vm_size_completion_list, ) from ._consts import ( @@ -246,7 +244,7 @@ def load_arguments(self, _): help='Node pool name, upto 12 alphanumeric characters', validator=validate_nodepool_name) c.argument('node_vm_size', options_list=[ '--node-vm-size', '-s'], completer=get_vm_size_completion_list) - c.argument('os_sku', completer=get_cluster_ossku_completion_list) + c.argument('os_sku', arg_type=get_enum_type(node_os_skus)) c.argument('vnet_subnet_id', validator=validate_vnet_subnet_id) c.argument('pod_subnet_id', validator=validate_pod_subnet_id) c.argument('enable_node_public_ip', action='store_true') @@ -413,8 +411,7 @@ def load_arguments(self, _): c.argument('node_vm_size', options_list=[ '--node-vm-size', '-s'], completer=get_vm_size_completion_list) c.argument('os_type') - c.argument('os_sku', options_list=[ - '--os-sku'], completer=get_nodepool_ossku_completion_list) + c.argument('os_sku', arg_type=get_enum_type(node_os_skus)) c.argument('vnet_subnet_id', validator=validate_vnet_subnet_id) c.argument('pod_subnet_id', diff --git a/src/aks-preview/setup.py b/src/aks-preview/setup.py index b71436ad77d..2b1fc2e3f67 100644 --- a/src/aks-preview/setup.py +++ b/src/aks-preview/setup.py @@ -9,7 +9,7 @@ from setuptools import setup, find_packages -VERSION = "0.5.68" +VERSION = "0.5.69" CLASSIFIERS = [ "Development Status :: 4 - Beta", "Intended Audience :: Developers",