fix: omc upgrade and restart issue

This commit is contained in:
2024-04-16 11:19:07 +08:00
parent 0c149785a7
commit 56842910f6
2 changed files with 13 additions and 9 deletions

View File

@@ -858,15 +858,19 @@ func PostNeServiceAction(w http.ResponseWriter, r *http.Request) {
sshHost := fmt.Sprintf("%s@%s", config.GetYamlConfig().NE.User, neInfo.Ip)
switch neTypeLower {
case "omc":
// send 204 to fe firstly
services.ResponseStatusOK204NoContent(w)
actionCmd := fmt.Sprintf("sudo %s/bin/omcsvc.sh %s", config.GetYamlConfig().NE.OmcDir, action)
cmd := exec.Command("ssh", sshHost, actionCmd)
out, err := cmd.CombinedOutput()
log.Debugf("Exec output: %v", string(out))
if err != nil {
log.Errorf("Faile to execute ssh %s omc:%v", action, err)
services.ResponseInternalServerError500ProcessError(w, err)
return
}
go RunSSHCmd(sshHost, actionCmd)
return
// cmd := exec.Command("ssh", sshHost, actionCmd)
// out, err := cmd.CombinedOutput()
// log.Debugf("Exec output: %v", string(out))
// if err != nil {
// log.Errorf("Faile to execute ssh %s omc:%v", action, err)
// services.ResponseInternalServerError500ProcessError(w, err)
// return
// }
case "ims":
switch action {
case "start", "stop":

View File

@@ -930,7 +930,7 @@ func RollBackSoftwareToNF(w http.ResponseWriter, r *http.Request) {
return
}
services.ResponseStatusOK204NoContent(w)
RunSSHCmd(sshHost, runCmd)
go RunSSHCmd(sshHost, runCmd)
return
}
err = RunSSHCmd(sshHost, runCmd)