Skip to content

Commit

Permalink
Improved verbose logging for server state (scaleway#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed Aug 3, 2015
1 parent 5a9c908 commit 1414122
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 6 additions & 0 deletions api/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,14 @@ func WaitForServerState(api *ScalewayAPI, serverID string, targetState string) (
var server *ScalewayServer
var err error

var currentState string

for {
server, err = api.GetServer(serverID)
if currentState != server.State {
log.Infof("Server changed state to '%s'", server.State)
currentState = server.State
}
if err != nil {
return nil, err
}
Expand Down
2 changes: 0 additions & 2 deletions commands/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package commands
import (
"fmt"
"os"
"time"

log "github.com/scaleway/scaleway-cli/vendor/github.com/Sirupsen/logrus"

Expand Down Expand Up @@ -114,7 +113,6 @@ func runRun(cmd *types.Command, args []string) {
// waiting for server to be ready
log.Debug("Waiting for server to be ready")
// We wait for 30 seconds, which is the minimal amount of time needed by a server to boot
time.Sleep(30 * time.Second)
server, err := api.WaitForServerReady(cmd.API, serverID, gateway)
if err != nil {
log.Fatalf("Cannot get access to server %s: %v", serverID, err)
Expand Down

0 comments on commit 1414122

Please sign in to comment.