Skip to content

Commit 8fc6b39

Browse files
committed
handle remote setup failure
1 parent a2f46ee commit 8fc6b39

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

app/job_ssh.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,7 @@ func (m ModJobSshStruct) setupClusterInner(clusterConf clusterconf.ClusterConfYm
334334
}
335335
_ = base64.StdEncoding.EncodeToString(pubkeybytes)
336336

337-
// output, logfps :=
338-
util.StartRemoteCmds(
337+
output, _ := util.StartRemoteCmds(
339338
hosts,
340339

341340
util.ModRunCmd.CmdModels().InstallTelegoWithPy()+" && "+
@@ -348,17 +347,18 @@ func (m ModJobSshStruct) setupClusterInner(clusterConf clusterconf.ClusterConfYm
348347
// fmt.Println(color.RedString("read logfdebug failed: %v", err))
349348
// os.Exit(1)
350349
// }
351-
// srcs := []string{output[0], string(logfdebug)}
352-
// keywords := []string{"error", "失败"}
353-
// if funk.Any(srcs, func(src string) bool {
354-
// return funk.Any(keywords, func(keyword string) bool {
355-
// return strings.Contains(src, keyword)
356-
// })
357-
// }) {
358-
// fmt.Println(color.RedString("ssh error: %s", output))
359-
// // debug sshd_config
360-
// util.ModRunCmd.NewBuilder("cat", "/etc/ssh/sshd_config").WithRoot().ShowProgress().BlockRun()
361-
// }
350+
srcs := []string{output[0]}
351+
keywords := []string{"Error Process exited"}
352+
if funk.Any(srcs, func(src string) bool {
353+
return funk.Any(keywords, func(keyword string) bool {
354+
return strings.Contains(src, keyword)
355+
})
356+
}) {
357+
fmt.Println(color.RedString("ssh setup remote pubkey error: %s", output))
358+
os.Exit(1)
359+
// // debug sshd_config
360+
// util.ModRunCmd.NewBuilder("cat", "/etc/ssh/sshd_config").WithRoot().ShowProgress().BlockRun()
361+
}
362362
}
363363

364364
// https://qcnoe3hd7k5c.feishu.cn/wiki/V6eHwZm1aiofeykaSd5cmgPcnSe#share-Hc1hdGT26oI4I0xPaplcEhMundd

0 commit comments

Comments
 (0)