diff --git a/README.md b/README.md index 9d994e2a..ec3c9087 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,7 @@ $> curl --silent http://212.47.248.251 | head -n1 # you can also open your brows ### master (unreleased) +* Sleep only when we stop an host ([#4](https://github.com/scaleway/docker-machine-driver-scaleway/issues/4)) * Support of `create` * Support of `start` * Support of `stop` diff --git a/driver/scaleway.go b/driver/scaleway.go index a9ebb0ce..a6990df7 100644 --- a/driver/scaleway.go +++ b/driver/scaleway.go @@ -34,6 +34,7 @@ type Driver struct { Token string commercialType string name string + stopping bool // size string // userDataFile string // ipv6 bool @@ -178,7 +179,9 @@ func (d *Driver) GetState() (st state.State, err error) { case "stopped": st = state.Stopped } - time.Sleep(5 * time.Second) + if d.stopping { + time.Sleep(5 * time.Second) + } return } @@ -240,5 +243,6 @@ func (d *Driver) Start() error { // Stop stops the server func (d *Driver) Stop() error { + d.stopping = true return d.postAction("poweroff") }