Signed-off-by: Ken Pepple <ken@solinea.com>
This commit is contained in:
16
commands.go
16
commands.go
@@ -760,6 +760,10 @@ func cmdSsh(c *cli.Context) {
|
||||
log.Fatalf("unable to get active host: %v", err)
|
||||
}
|
||||
|
||||
if host == nil {
|
||||
log.Fatalf("There is no active host. Please set it with %s active <machine name>.", c.App.Name)
|
||||
}
|
||||
|
||||
name = host.Name
|
||||
}
|
||||
|
||||
@@ -768,6 +772,15 @@ func cmdSsh(c *cli.Context) {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
_, err = host.GetURL()
|
||||
if err != nil {
|
||||
if err == drivers.ErrHostIsNotRunning {
|
||||
log.Fatalf("%s is not running. Please start this with docker-machine start %s", host.Name, host.Name)
|
||||
} else {
|
||||
log.Fatalf("Unexpected error getting machine url: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
if len(c.Args()) <= 1 {
|
||||
sshCmd, err = host.GetSSHCommand()
|
||||
} else {
|
||||
@@ -880,6 +893,9 @@ func runActionWithContext(actionName string, c *cli.Context) error {
|
||||
if err != nil {
|
||||
log.Fatalf("Unable to get active host: %v", err)
|
||||
}
|
||||
if activeHost == nil {
|
||||
log.Fatalf("There is no active host. Please set it with %s active <machine name>.", c.App.Name)
|
||||
}
|
||||
machines = []*libmachine.Host{activeHost}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user