From 580d1f782da9c7969a2b66e9ebf67b2be100a50d Mon Sep 17 00:00:00 2001 From: Mikita Pilinka Date: Wed, 13 Mar 2024 16:05:10 +0100 Subject: [PATCH] fix: proper error message when typing unsupported/unknown platform Ticket: ENT-11138 Changelog: None Signed-off-by: Mikita Pilinka --- cf_remote/spawn.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cf_remote/spawn.py b/cf_remote/spawn.py index c785592..25492cd 100644 --- a/cf_remote/spawn.py +++ b/cf_remote/spawn.py @@ -11,7 +11,7 @@ from cf_remote.cloud_data import aws_platforms from cf_remote.utils import whoami from cf_remote import log - +from cf_remote import cloud_data _NAME_RANDOM_PART_LENGTH = 4 @@ -317,7 +317,9 @@ def spawn_vm_in_aws( else: if any(vm.state in (0, "running") and vm.name == name for vm in existing_vms): raise ValueError("VM with the name '%s' already exists" % name) - + if not platform in aws_platforms: + raise ValueError("Platform '%s' does not exist.\nList of available platforms:\n%s" % (platform, + "\n".join(cloud_data.aws_platforms.keys()))) aws_platform = aws_platforms[platform] size = size or aws_platform.get("xlsize") or aws_platform["size"] user = aws_platform.get("user")