fix: change user issue
This commit is contained in:
@@ -697,19 +697,27 @@ func ActiveSoftwareToNF(w http.ResponseWriter, r *http.Request) {
|
|||||||
if !config.GetYamlConfig().OMC.TestMode {
|
if !config.GetYamlConfig().OMC.TestMode {
|
||||||
filePath := (*neVersion)[0]["file_path"]
|
filePath := (*neVersion)[0]["file_path"]
|
||||||
sshHost := fmt.Sprintf("%s@%s", config.GetYamlConfig().NE.User, neInfo.Ip)
|
sshHost := fmt.Sprintf("%s@%s", config.GetYamlConfig().NE.User, neInfo.Ip)
|
||||||
srcFile := fmt.Sprintf("%s/actpkg.sh", config.GetYamlConfig().OMC.BinDir)
|
|
||||||
|
|
||||||
|
runCmd := fmt.Sprintf("sudo rm -f %s/actpkg.sh", config.GetYamlConfig().NE.ScpDir)
|
||||||
|
err = RunSSHCmd(sshHost, runCmd)
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("Failed to run cmd: %s", runCmd)
|
||||||
|
services.ResponseInternalServerError500ProcessError(w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
srcFile := fmt.Sprintf("%s/actpkg.sh", config.GetYamlConfig().OMC.BinDir)
|
||||||
scpDir := fmt.Sprintf("%s@%s:%s", config.GetYamlConfig().NE.User,
|
scpDir := fmt.Sprintf("%s@%s:%s", config.GetYamlConfig().NE.User,
|
||||||
neInfo.Ip, config.GetYamlConfig().NE.ScpDir)
|
neInfo.Ip, config.GetYamlConfig().NE.ScpDir)
|
||||||
cmd := exec.Command("scp", "-r", srcFile, scpDir)
|
cmd := exec.Command("scp", "-r", srcFile, scpDir)
|
||||||
_, err := cmd.CombinedOutput()
|
_, err := cmd.CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("Faile to scp NF: neType=%s, neId=%s, ip=%s", neType, neId, neInfo.Ip)
|
log.Errorf("Failed to scp NF: neType=%s, neId=%s, ip=%s", neType, neId, neInfo.Ip)
|
||||||
services.ResponseInternalServerError500ProcessError(w, err)
|
services.ResponseInternalServerError500ProcessError(w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
runCmd := fmt.Sprintf("sudo %s/actpkg.sh '%s' %s",
|
runCmd = fmt.Sprintf("sudo %s/actpkg.sh '%s' %s",
|
||||||
config.GetYamlConfig().NE.ScpDir, filePath, neTypeUpper)
|
config.GetYamlConfig().NE.ScpDir, filePath, neTypeUpper)
|
||||||
if neTypeLower == "omc" {
|
if neTypeLower == "omc" {
|
||||||
idNeVersion, _ := strconv.Atoi((*neVersion)[0]["id"])
|
idNeVersion, _ := strconv.Atoi((*neVersion)[0]["id"])
|
||||||
@@ -897,6 +905,14 @@ func RollBackSoftwareToNF(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
if !config.GetYamlConfig().OMC.TestMode {
|
if !config.GetYamlConfig().OMC.TestMode {
|
||||||
sshHost := fmt.Sprintf("%s@%s", config.GetYamlConfig().NE.User, neInfo.Ip)
|
sshHost := fmt.Sprintf("%s@%s", config.GetYamlConfig().NE.User, neInfo.Ip)
|
||||||
|
runCmd := fmt.Sprintf("sudo rm -f %s/rbkpkg.sh", config.GetYamlConfig().NE.ScpDir)
|
||||||
|
err = RunSSHCmd(sshHost, runCmd)
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("Failed to run cmd: %s", runCmd)
|
||||||
|
services.ResponseInternalServerError500ProcessError(w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
srcFile := fmt.Sprintf("%s/rbkpkg.sh", config.GetYamlConfig().OMC.BinDir)
|
srcFile := fmt.Sprintf("%s/rbkpkg.sh", config.GetYamlConfig().OMC.BinDir)
|
||||||
|
|
||||||
scpDir := fmt.Sprintf("%s@%s:%s", config.GetYamlConfig().NE.User,
|
scpDir := fmt.Sprintf("%s@%s:%s", config.GetYamlConfig().NE.User,
|
||||||
@@ -909,7 +925,7 @@ func RollBackSoftwareToNF(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
runCmd := fmt.Sprintf("sudo %s/rbkpkg.sh '%s' %s",
|
runCmd = fmt.Sprintf("sudo %s/rbkpkg.sh '%s' %s",
|
||||||
config.GetYamlConfig().NE.ScpDir, filePath, neTypeUpper)
|
config.GetYamlConfig().NE.ScpDir, filePath, neTypeUpper)
|
||||||
if neTypeLower == "omc" {
|
if neTypeLower == "omc" {
|
||||||
idNeVersion, _ := strconv.Atoi((*neVersion)[0]["id"])
|
idNeVersion, _ := strconv.Atoi((*neVersion)[0]["id"])
|
||||||
|
|||||||
Reference in New Issue
Block a user