From c95e2a94b9a20e8fbe1d3f8c763d19c9dace8f78 Mon Sep 17 00:00:00 2001 From: Himani Anil Deshpande Date: Mon, 17 Mar 2025 16:32:05 -0400 Subject: [PATCH] [Ubuntu24] Add Ubuntu24 for other validators --- cli/src/pcluster/constants.py | 2 +- cli/src/pcluster/validators/ec2_validators.py | 4 ++-- cli/tests/pcluster/validators/test_cluster_validators.py | 2 ++ cli/tests/pcluster/validators/test_ec2_validators.py | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cli/src/pcluster/constants.py b/cli/src/pcluster/constants.py index aefdc983bd..e354eea90e 100644 --- a/cli/src/pcluster/constants.py +++ b/cli/src/pcluster/constants.py @@ -35,7 +35,7 @@ "rocky9", ] SUPPORTED_OSES_FOR_SCHEDULER = {"slurm": SUPPORTED_OSES, "awsbatch": ["alinux2", "alinux2023"]} -UNSUPPORTED_OSES_FOR_MICRO_NANO = ["ubuntu2004", "ubuntu2204", "rhel8", "rocky8", "rhel9", "rocky9"] +UNSUPPORTED_OSES_FOR_MICRO_NANO = ["ubuntu2004", "ubuntu2204", "ubuntu2404", "rhel8", "rocky8", "rhel9", "rocky9"] UNSUPPORTED_OSES_FOR_DCV = ["alinux2023"] UNSUPPORTED_ARM_OSES_FOR_DCV = ["ubuntu2004"] UNSUPPORTED_OSES_FOR_LUSTRE = ["ubuntu2404"] diff --git a/cli/src/pcluster/validators/ec2_validators.py b/cli/src/pcluster/validators/ec2_validators.py index 068e080a03..1303c5dd5a 100644 --- a/cli/src/pcluster/validators/ec2_validators.py +++ b/cli/src/pcluster/validators/ec2_validators.py @@ -212,9 +212,9 @@ def _validate(self, key_name: str, os: str): if key_name: try: key_pair = KeyPairInfo(key_name) - if os == "ubuntu2204" and key_pair.key_type == "rsa": + if os in ["ubuntu2204", "ubuntu2404"] and key_pair.key_type == "rsa": self._add_failure( - "Ubuntu 22.04 does not support RSA keys. Please generate and use an ed25519 key", + f"{os} does not support RSA keys. Please generate and use an ed25519 key", FailureLevel.ERROR, ) except AWSClientError as e: diff --git a/cli/tests/pcluster/validators/test_cluster_validators.py b/cli/tests/pcluster/validators/test_cluster_validators.py index 19287e525d..d87feab290 100644 --- a/cli/tests/pcluster/validators/test_cluster_validators.py +++ b/cli/tests/pcluster/validators/test_cluster_validators.py @@ -3509,6 +3509,7 @@ def test_multi_network_interfaces_instances_validator( ("ami-000000000000", "rhel8", None, None), ("ami-000000000000", "ubuntu22", None, None), ("ami-000000000000", "ubuntu20", None, None), + ("ami-000000000000", "ubuntu24", None, None), ( None, "rocky8", @@ -3522,6 +3523,7 @@ def test_multi_network_interfaces_instances_validator( (None, "rhel8", None, None), (None, "ubuntu22", None, None), (None, "ubuntu20", None, None), + (None, "ubuntu24", None, None), ], ) def test_compute_ami_os_compatible_validator(mocker, custom_ami_id, os, expected_message, expected_failure_level): diff --git a/cli/tests/pcluster/validators/test_ec2_validators.py b/cli/tests/pcluster/validators/test_ec2_validators.py index 46c5ccc701..e8007c408e 100644 --- a/cli/tests/pcluster/validators/test_ec2_validators.py +++ b/cli/tests/pcluster/validators/test_ec2_validators.py @@ -472,7 +472,8 @@ def test_instance_type_os_compatible_validator(instance_type, os, expected_messa "does not exist", ), ("key-name", GoodKeyPairsDict, "ubuntu2204", None, None), - ("key-name", BadKeyPairsDict, "ubuntu2204", None, "Ubuntu 22.04 does not support RSA keys"), + ("key-name", BadKeyPairsDict, "ubuntu2204", None, "ubuntu2204 does not support RSA keys"), + ("key-name", BadKeyPairsDict, "ubuntu2404", None, "ubuntu2404 does not support RSA keys"), ("key-name", GoodKeyPairsDict, "ubuntu2004", None, None), ("key-name", BadKeyPairsDict, "ubuntu2004", None, None), ("key-name", GoodKeyPairsDict, "rhel8", None, None),