X Tutup
Skip to content

Commit e55dfb2

Browse files
Start machine if needed for upgrade
Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
1 parent e40b9b3 commit e55dfb2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

libmachine/host/host.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package host
22

33
import (
4-
"errors"
54
"regexp"
65

76
"github.com/docker/machine/libmachine/auth"
@@ -19,9 +18,8 @@ import (
1918
)
2019

2120
var (
22-
validHostNamePattern = regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9\-\.]*$`)
23-
errMachineMustBeRunningForUpgrade = errors.New("machine must be running to upgrade")
24-
stdSSHClientCreator SSHClientCreator = &StandardSSHClientCreator{}
21+
validHostNamePattern = regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9\-\.]*$`)
22+
stdSSHClientCreator SSHClientCreator = &StandardSSHClientCreator{}
2523
)
2624

2725
type SSHClientCreator interface {
@@ -171,7 +169,10 @@ func (h *Host) Upgrade() error {
171169
}
172170

173171
if machineState != state.Running {
174-
return errMachineMustBeRunningForUpgrade
172+
log.Info("Starting machine so machine can be upgraded...")
173+
if err := h.Start(); err != nil {
174+
return err
175+
}
175176
}
176177

177178
provisioner, err := provision.DetectProvisioner(h.Driver)

0 commit comments

Comments
 (0)
X Tutup