restart ne
This commit is contained in:
@@ -632,7 +632,7 @@ func ActiveSoftwareToNF(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
neTypeUpper := strings.ToUpper(neType)
|
||||
//neTypeLower := strings.ToLower(neType)
|
||||
neTypeLower := strings.ToLower(neType)
|
||||
|
||||
version := vars["version"]
|
||||
if version == "" {
|
||||
@@ -691,7 +691,7 @@ func ActiveSoftwareToNF(w http.ResponseWriter, r *http.Request) {
|
||||
rpmCmd := fmt.Sprintf("sudo rpm -Uvh '%s'", filePath)
|
||||
cmd := exec.Command("ssh", sshHost, rpmCmd)
|
||||
out, err := cmd.CombinedOutput()
|
||||
log.Tracef("Exec output: %v", string(out))
|
||||
log.Debugf("Exec output: %v", string(out))
|
||||
if err != nil {
|
||||
log.Error("Faile to execute rpm command:", err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
@@ -701,7 +701,7 @@ func ActiveSoftwareToNF(w http.ResponseWriter, r *http.Request) {
|
||||
dpkgCmd := fmt.Sprintf("sudo dpkg -i '%s'", filePath)
|
||||
cmd := exec.Command("ssh", sshHost, dpkgCmd)
|
||||
out, err := cmd.CombinedOutput()
|
||||
log.Tracef("Exec output: %v", string(out))
|
||||
log.Debugf("Exec output: %v", string(out))
|
||||
if err != nil {
|
||||
log.Error("Faile to execute dpkg command:", err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
@@ -713,6 +713,27 @@ func ActiveSoftwareToNF(w http.ResponseWriter, r *http.Request) {
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
if neTypeLower != "omc" {
|
||||
restartCmd := fmt.Sprintf("sudo systemctl restart %s.service", neTypeLower)
|
||||
cmd := exec.Command("ssh", sshHost, restartCmd)
|
||||
out, err := cmd.CombinedOutput()
|
||||
log.Debugf("Exec output: %v", string(out))
|
||||
if err != nil {
|
||||
log.Error("Faile to execute ssh sudo systemctl command:", err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
restartCmd := fmt.Sprintf("sudo %s/bin/omcsvc.sh restart", config.GetYamlConfig().NE.OmcDir)
|
||||
cmd := exec.Command("ssh", sshHost, restartCmd)
|
||||
out, err := cmd.CombinedOutput()
|
||||
log.Debugf("Exec output: %v", string(out))
|
||||
if err != nil {
|
||||
log.Error("Faile to execute ssh restart omc:", err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
idNeVersion, _ := strconv.Atoi((*neVersion)[0]["id"])
|
||||
|
||||
Reference in New Issue
Block a user