Skip to content

Commit 3dce526

Browse files
committed
debug ssh setup remote pubkey error
1 parent 8fc6b39 commit 3dce526

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

app/job_ssh.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ func (m ModJobSshStruct) sshLocal(job SshJob) {
101101

102102
// 用正则表达式验证公钥格式
103103
func (m ModJobSshStruct) setupThisNode(pubkey string) {
104+
util.PrintStep("job ssh", "setupThisNode started")
104105
pubkey = strings.TrimSpace(pubkey)
105106
innerSetPubkeyOnThisNode := func(pubkey string) error {
106107
// 校验公钥格式
@@ -151,6 +152,7 @@ func (m ModJobSshStruct) setupThisNode(pubkey string) {
151152
err := innerSetPubkeyOnThisNode(pubkey)
152153
if err != nil {
153154
fmt.Println(color.RedString("set pubkey failed: %v", err))
155+
os.Exit(1)
154156
} else {
155157
fmt.Println(color.GreenString("set pubkey success"))
156158
}
@@ -354,7 +356,8 @@ func (m ModJobSshStruct) setupClusterInner(clusterConf clusterconf.ClusterConfYm
354356
return strings.Contains(src, keyword)
355357
})
356358
}) {
357-
fmt.Println(color.RedString("ssh setup remote pubkey error: %s", output))
359+
fmt.Println(color.RedString("ssh setup remote pubkey error: %v", output))
360+
fmt.Println(color.RedString("recent remote log: %v", util.GetMostRecentRemoteLog()))
358361
os.Exit(1)
359362
// // debug sshd_config
360363
// util.ModRunCmd.NewBuilder("cat", "/etc/ssh/sshd_config").WithRoot().ShowProgress().BlockRun()

app/lib.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ func Main() {
230230
rootCmd.AddCommand(cmd)
231231
}
232232

233+
util.PrintStep("telego start", "telego try dispatch sub jobs")
233234
rootCmd.Execute()
234235
if !parseFail {
235236
return

0 commit comments

Comments
 (0)