This commit is contained in:
2023-09-16 19:23:11 +08:00
parent 9c8b4d8dc8
commit de9189bd32
6 changed files with 119 additions and 84 deletions

View File

@@ -666,7 +666,7 @@ func ActiveSoftwareToNF(w http.ResponseWriter, r *http.Request) {
}
log.Debug("neVersion:", neVersion)
if config.GetYamlConfig().OMC.TestMode == false {
if !config.GetYamlConfig().OMC.TestMode {
filePath := (*neVersion)[0]["file_path"]
sshHost := fmt.Sprintf("%s@%s", config.GetYamlConfig().NE.User, neInfo.Ip)
rpmCmd := fmt.Sprintf("sudo rpm -Uvh '%s'", filePath)
@@ -680,7 +680,7 @@ func ActiveSoftwareToNF(w http.ResponseWriter, r *http.Request) {
}
}
idNeVersion, err := strconv.Atoi((*neVersion)[0]["id"])
idNeVersion, _ := strconv.Atoi((*neVersion)[0]["id"])
neVersionData := dborm.NeVersion{
Status: SoftwareStatusActive,
}
@@ -693,7 +693,6 @@ func ActiveSoftwareToNF(w http.ResponseWriter, r *http.Request) {
}
services.ResponseStatusOK204NoContent(w)
return
}
func RollBackSoftwareToNF(w http.ResponseWriter, r *http.Request) {
@@ -758,7 +757,7 @@ func RollBackSoftwareToNF(w http.ResponseWriter, r *http.Request) {
return
}
if config.GetYamlConfig().OMC.TestMode == false {
if !config.GetYamlConfig().OMC.TestMode {
sshHost := fmt.Sprintf("%s@%s", config.GetYamlConfig().NE.User, neInfo.Ip)
rpmCmd := fmt.Sprintf("rpm -Uvh --oldpackage '%s'", filePath)
cmd := exec.Command("ssh", sshHost, rpmCmd)
@@ -771,7 +770,7 @@ func RollBackSoftwareToNF(w http.ResponseWriter, r *http.Request) {
}
}
idNeVersion, err := strconv.Atoi((*neVersion)[0]["id"])
idNeVersion, _ := strconv.Atoi((*neVersion)[0]["id"])
neVersionData := dborm.NeVersion{
Version: (*neVersion)[0]["pre_version"],
FilePath: (*neVersion)[0]["pre_file"],
@@ -790,5 +789,4 @@ func RollBackSoftwareToNF(w http.ResponseWriter, r *http.Request) {
}
services.ResponseStatusOK204NoContent(w)
return
}