|
102 | 102 | CONST_OS_SKU_UBUNTU2404, |
103 | 103 | CONST_OS_SKU_WINDOWS2019, |
104 | 104 | CONST_OS_SKU_WINDOWS2022, |
| 105 | + CONST_OS_SKU_WINDOWS2025, |
105 | 106 | CONST_OS_SKU_WINDOWSANNUAL, |
106 | 107 | CONST_PATCH_UPGRADE_CHANNEL, |
107 | 108 | CONST_RAPID_UPGRADE_CHANNEL, |
|
287 | 288 | CONST_OS_SKU_AZURELINUXOSGUARD, |
288 | 289 | CONST_OS_SKU_AZURELINUX3OSGUARD, |
289 | 290 | ] |
290 | | -node_os_skus = node_os_skus_create + [ |
| 291 | +node_os_skus_add = node_os_skus_create + [ |
291 | 292 | CONST_OS_SKU_WINDOWS2019, |
292 | 293 | CONST_OS_SKU_WINDOWS2022, |
| 294 | + CONST_OS_SKU_WINDOWS2025, |
293 | 295 | CONST_OS_SKU_WINDOWSANNUAL, |
294 | 296 | ] |
295 | 297 | node_os_skus_update = [ |
|
439 | 441 | ] |
440 | 442 |
|
441 | 443 | # azure container storage |
| 444 | +# azure container storage |
| 445 | +container_storage_versions = [ |
| 446 | + "1", |
| 447 | + "2" |
| 448 | +] |
| 449 | + |
442 | 450 | storage_pool_types = [ |
443 | 451 | CONST_STORAGE_POOL_TYPE_AZURE_DISK, |
444 | 452 | CONST_STORAGE_POOL_TYPE_EPHEMERAL_DISK, |
@@ -1026,8 +1034,14 @@ def load_arguments(self, _): |
1026 | 1034 | # azure container storage |
1027 | 1035 | c.argument( |
1028 | 1036 | "enable_azure_container_storage", |
1029 | | - arg_type=get_enum_type(storage_pool_types), |
1030 | | - help="enable azure container storage and define storage pool type", |
| 1037 | + arg_type=_get_enable_azure_container_storage_type(), |
| 1038 | + help="enable azure container storage. Can be used as a flag (defaults to True) or with a" |
| 1039 | + " storage pool type value: (azureDisk, ephemeralDisk, elasticSan)", |
| 1040 | + ) |
| 1041 | + c.argument( |
| 1042 | + "container_storage_version", |
| 1043 | + arg_type=get_enum_type(container_storage_versions), |
| 1044 | + help="set azure container storage version, the latest version will be installed by default", |
1031 | 1045 | ) |
1032 | 1046 | c.argument( |
1033 | 1047 | "storage_pool_name", |
@@ -1486,13 +1500,21 @@ def load_arguments(self, _): |
1486 | 1500 | # azure container storage |
1487 | 1501 | c.argument( |
1488 | 1502 | "enable_azure_container_storage", |
1489 | | - arg_type=get_enum_type(storage_pool_types), |
1490 | | - help="enable azure container storage and define storage pool type", |
| 1503 | + arg_type=_get_enable_azure_container_storage_type(), |
| 1504 | + help="enable azure container storage. Can be used as a flag (defaults to True) or with a" |
| 1505 | + " storage pool type value: (azureDisk, ephemeralDisk, elasticSan)", |
1491 | 1506 | ) |
1492 | 1507 | c.argument( |
1493 | 1508 | "disable_azure_container_storage", |
1494 | | - arg_type=get_enum_type(disable_storage_pool_types), |
1495 | | - help="disable azure container storage or any one of the storage pool types", |
| 1509 | + arg_type=_get_disable_azure_container_storage_type(), |
| 1510 | + help="disable azure container storage or any one of the storage pool types." |
| 1511 | + " Can be used as a flag (defaults to True) or with a storagepool type value:" |
| 1512 | + " azureDisk, ephemeralDisk, elasticSan, all (to disable all storage pools).", |
| 1513 | + ) |
| 1514 | + c.argument( |
| 1515 | + "container_storage_version", |
| 1516 | + arg_type=get_enum_type(container_storage_versions), |
| 1517 | + help="set azure container storage version, the latest version will be installed by default", |
1496 | 1518 | ) |
1497 | 1519 | c.argument( |
1498 | 1520 | "storage_pool_name", |
@@ -1675,7 +1697,7 @@ def load_arguments(self, _): |
1675 | 1697 | ) |
1676 | 1698 | c.argument("os_type") |
1677 | 1699 | c.argument( |
1678 | | - "os_sku", arg_type=get_enum_type(node_os_skus), validator=validate_os_sku |
| 1700 | + "os_sku", arg_type=get_enum_type(node_os_skus_add), validator=validate_os_sku |
1679 | 1701 | ) |
1680 | 1702 | c.argument("snapshot_id", validator=validate_snapshot_id) |
1681 | 1703 | c.argument("vnet_subnet_id", validator=validate_vnet_subnet_id) |
@@ -2026,7 +2048,7 @@ def load_arguments(self, _): |
2026 | 2048 | "machine_name", help="The machine name." |
2027 | 2049 | ) |
2028 | 2050 | c.argument( |
2029 | | - "os_sku", arg_type=get_enum_type(node_os_skus), validator=validate_os_sku |
| 2051 | + "os_sku", arg_type=get_enum_type(node_os_skus_add), validator=validate_os_sku |
2030 | 2052 | ) |
2031 | 2053 | c.argument( |
2032 | 2054 | "zones", |
@@ -2920,3 +2942,65 @@ def _get_default_install_location(exe_name): |
2920 | 2942 | else: |
2921 | 2943 | install_location = None |
2922 | 2944 | return install_location |
| 2945 | + |
| 2946 | + |
| 2947 | +def _get_enable_azure_container_storage_type(): |
| 2948 | + """Custom argument type that accepts both None and enum values""" |
| 2949 | + import argparse |
| 2950 | + from azure.cli.core.azclierror import InvalidArgumentValueError |
| 2951 | + |
| 2952 | + class AzureContainerStorageAction(argparse.Action): |
| 2953 | + def __call__(self, parser, namespace, values, option_string=None): |
| 2954 | + if values is None: |
| 2955 | + # When used as a flag without value, set as True |
| 2956 | + setattr(namespace, self.dest, True) |
| 2957 | + return |
| 2958 | + |
| 2959 | + if isinstance(values, str): |
| 2960 | + # Handle enum values (case insensitive) |
| 2961 | + for storage_type in storage_pool_types: |
| 2962 | + if values.lower() == storage_type.lower(): |
| 2963 | + setattr(namespace, self.dest, storage_type) |
| 2964 | + return |
| 2965 | + |
| 2966 | + # Invalid value |
| 2967 | + valid_values = storage_pool_types |
| 2968 | + raise InvalidArgumentValueError( |
| 2969 | + f"Invalid value '{values}'. Valid values are: {', '.join(valid_values)}" |
| 2970 | + ) |
| 2971 | + |
| 2972 | + return CLIArgumentType( |
| 2973 | + nargs='?', # Optional argument |
| 2974 | + action=AzureContainerStorageAction, |
| 2975 | + ) |
| 2976 | + |
| 2977 | + |
| 2978 | +def _get_disable_azure_container_storage_type(): |
| 2979 | + """Custom argument type that accepts both None and enum values""" |
| 2980 | + import argparse |
| 2981 | + from azure.cli.core.azclierror import InvalidArgumentValueError |
| 2982 | + |
| 2983 | + class AzureContainerStorageAction(argparse.Action): |
| 2984 | + def __call__(self, parser, namespace, values, option_string=None): |
| 2985 | + if values is None: |
| 2986 | + # When used as a flag without value, set as True |
| 2987 | + setattr(namespace, self.dest, True) |
| 2988 | + return |
| 2989 | + |
| 2990 | + if isinstance(values, str): |
| 2991 | + # Handle enum values (case insensitive) |
| 2992 | + for storage_type in disable_storage_pool_types: |
| 2993 | + if values.lower() == storage_type.lower(): |
| 2994 | + setattr(namespace, self.dest, storage_type) |
| 2995 | + return |
| 2996 | + |
| 2997 | + # Invalid value |
| 2998 | + valid_values = disable_storage_pool_types |
| 2999 | + raise InvalidArgumentValueError( |
| 3000 | + f"Invalid value '{values}'. Valid values are: {', '.join(valid_values)}" |
| 3001 | + ) |
| 3002 | + |
| 3003 | + return CLIArgumentType( |
| 3004 | + nargs='?', # Optional argument |
| 3005 | + action=AzureContainerStorageAction, |
| 3006 | + ) |
0 commit comments