1
0
Fork 0

Wait until ssh is available

timestamps
dump_stack() 2023-02-16 06:27:17 +00:00
parent f97cb3f10a
commit 24b6749504
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC
3 changed files with 24 additions and 0 deletions

View File

@ -207,6 +207,11 @@ func debugHandler(kcfg config.KernelConfig, workPath, kernRegex, gdb string,
}
defer os.RemoveAll(tmp)
err = q.WaitForSSH(time.Minute)
if err != nil {
return
}
if ka.StandardModules {
// Module depends on one of the standard modules
err = copyStandardModules(q, ki)

5
pew.go
View File

@ -506,6 +506,11 @@ func whatever(swg *sizedwaitgroup.SizedWaitGroup, ka config.Artifact,
}
}
err = q.WaitForSSH(qemuTimeout)
if err != nil {
return
}
remoteTest, err := copyTest(q, testPath, ka)
if err != nil {
return

View File

@ -307,6 +307,20 @@ func (q *System) Stop() {
}
}
func (q System) WaitForSSH(timeout time.Duration) error {
for start := time.Now(); time.Since(start) < timeout; {
client, err := q.ssh("root")
if err != nil {
time.Sleep(time.Second / 10)
continue
}
client.Close()
return nil
}
return errors.New("no ssh (timeout)")
}
func (q System) ssh(user string) (client *ssh.Client, err error) {
cfg := &ssh.ClientConfig{
User: user,