Skip to content

Commit 3165ce8

Browse files
authored
fix(instance): show unknown server-type availability when missing (#3760)
1 parent bacb5d2 commit 3165ce8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

internal/namespaces/instance/v1/custom_server_type.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ func serverTypeListBuilder(c *core.Command) *core.Command {
9494
continue
9595
}
9696

97+
serverTypeAvailability := instance.ServerTypesAvailability("unknown")
98+
99+
if availability, exists := availabilitiesResponse.Servers[name]; exists {
100+
serverTypeAvailability = availability.Availability
101+
}
102+
97103
serverTypes = append(serverTypes, &customServerType{
98104
Name: name,
99105
HourlyPrice: scw.NewMoneyFromFloat(float64(serverType.HourlyPrice), "EUR", 3),
@@ -102,7 +108,7 @@ func serverTypeListBuilder(c *core.Command) *core.Command {
102108
GPU: serverType.Gpu,
103109
RAM: scw.Size(serverType.RAM),
104110
Arch: serverType.Arch,
105-
Availability: availabilitiesResponse.Servers[name].Availability,
111+
Availability: serverTypeAvailability,
106112
})
107113
}
108114

0 commit comments

Comments
 (0)