Skip to content

Commit

Permalink
fix: list servers only in available zones (#128)
Browse files Browse the repository at this point in the history
scw.AllZones contains zones that could not be available for those APIs
  • Loading branch information
Codelax authored and Tomy2e committed May 3, 2023
1 parent a8fece0 commit c9530ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion scaleway/baremetal.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ func (b *baremetal) getServerByName(name string) (*scwbaremetal.Server, error) {
}

var server *scwbaremetal.Server
for _, zoneReq := range scw.AllZones {
allZones := (*scwbaremetal.API)(nil).Zones()
for _, zoneReq := range allZones {
resp, err := b.api.ListServers(&scwbaremetal.ListServersRequest{
Zone: zoneReq,
Name: &name,
Expand Down
3 changes: 2 additions & 1 deletion scaleway/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ func (i *instances) getServerByName(name string) (*scwinstance.Server, error) {
}

var instanceServer *scwinstance.Server
for _, zoneReq := range scw.AllZones {
allZones := (*scwinstance.API)(nil).Zones()
for _, zoneReq := range allZones {
resp, err := i.api.ListServers(&scwinstance.ListServersRequest{
Zone: zoneReq,
Name: &name,
Expand Down

0 comments on commit c9530ce

Please sign in to comment.