1
0

Try creating a new session in ssh check

This commit is contained in:
dump_stack() 2023-05-07 15:24:10 +00:00
parent e8a446ec76
commit 0826948568
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC

View File

@ -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
} }