Skip to content

Commit

Permalink
fix(instance): show unknown server-type availability when missing (#3760
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Codelax authored Apr 11, 2024
1 parent bacb5d2 commit 3165ce8
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 3165ce8

Please sign in to comment.