From 3165ce8250e313ed4e2993736c73c66462f98d24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jules=20Cast=C3=A9ran?= Date: Thu, 11 Apr 2024 11:29:47 +0200 Subject: [PATCH] fix(instance): show unknown server-type availability when missing (#3760) --- internal/namespaces/instance/v1/custom_server_type.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/namespaces/instance/v1/custom_server_type.go b/internal/namespaces/instance/v1/custom_server_type.go index fe16aa4b58..aeba3774fe 100644 --- a/internal/namespaces/instance/v1/custom_server_type.go +++ b/internal/namespaces/instance/v1/custom_server_type.go @@ -94,6 +94,12 @@ func serverTypeListBuilder(c *core.Command) *core.Command { continue } + serverTypeAvailability := instance.ServerTypesAvailability("unknown") + + if availability, exists := availabilitiesResponse.Servers[name]; exists { + serverTypeAvailability = availability.Availability + } + serverTypes = append(serverTypes, &customServerType{ Name: name, HourlyPrice: scw.NewMoneyFromFloat(float64(serverType.HourlyPrice), "EUR", 3), @@ -102,7 +108,7 @@ func serverTypeListBuilder(c *core.Command) *core.Command { GPU: serverType.Gpu, RAM: scw.Size(serverType.RAM), Arch: serverType.Arch, - Availability: availabilitiesResponse.Servers[name].Availability, + Availability: serverTypeAvailability, }) }