Skip to content

Commit

Permalink
fix(instance): show unknown server-type availability when missing (sc…
Browse files Browse the repository at this point in the history
  • Loading branch information
Codelax authored and Laure-di committed Apr 16, 2024
1 parent 3e8ee96 commit b7d3951
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/namespaces/instance/v1/custom_server_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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,
})
}

Expand Down

0 comments on commit b7d3951

Please sign in to comment.