Merge pull request #4385 from josedonizetti/refactor-drivers-restart

Refactor: improve readability drivers.Restart
pull/4548/head
Thomas Strömberg 2019-06-21 08:07:35 +08:00 committed by GitHub
commit 02b8032b59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 5 deletions

View File

@ -84,12 +84,11 @@ func publicSSHKeyPath(d *drivers.BaseDriver) string {
// Restart a host. This may just call Stop(); Start() if the provider does not // Restart a host. This may just call Stop(); Start() if the provider does not
// have any special restart behaviour. // have any special restart behaviour.
func Restart(d drivers.Driver) error { func Restart(d drivers.Driver) error {
for _, f := range []func() error{d.Stop, d.Start} { if err := d.Stop(); err != nil {
if err := f(); err != nil {
return err return err
} }
}
return nil return d.Start()
} }
// MakeDiskImage makes a boot2docker VM disk image. // MakeDiskImage makes a boot2docker VM disk image.