Try creating a new session in ssh check
This commit is contained in:
parent
e8a446ec76
commit
0826948568
@ -337,11 +337,25 @@ func (q *System) Stop() {
|
|||||||
|
|
||||||
func (q System) WaitForSSH(timeout time.Duration) error {
|
func (q System) WaitForSSH(timeout time.Duration) error {
|
||||||
for start := time.Now(); time.Since(start) < timeout; {
|
for start := time.Now(); time.Since(start) < timeout; {
|
||||||
|
time.Sleep(time.Second / 4)
|
||||||
|
|
||||||
client, err := q.ssh("root")
|
client, err := q.ssh("root")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
time.Sleep(time.Second / 10)
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
session, err := client.NewSession()
|
||||||
|
if err != nil {
|
||||||
|
client.Close()
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = session.CombinedOutput("echo")
|
||||||
|
if err != nil {
|
||||||
|
client.Close()
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
client.Close()
|
client.Close()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user