d
This commit is contained in:
@@ -539,12 +539,12 @@ func DistributeSoftwareToNF(w http.ResponseWriter, r *http.Request) {
|
||||
log.Debug("neVersion:", neVersion)
|
||||
|
||||
sshHost := fmt.Sprintf("%s@%s", config.GetYamlConfig().NE.User, neInfo.Ip)
|
||||
mkdirCmd := fmt.Sprintf("mkdir -p %s/software/%s", config.GetYamlConfig().NE.OmcDir, neTypeLower)
|
||||
mkdirCmd := fmt.Sprintf("sudo mkdir -p %s/software/%s", config.GetYamlConfig().NE.OmcDir, neTypeLower)
|
||||
cmd := exec.Command("ssh", sshHost, mkdirCmd)
|
||||
out, err := cmd.CombinedOutput()
|
||||
log.Tracef("Exec output: %v", string(out))
|
||||
if err != nil {
|
||||
log.Error("Faile to exec cmd:", err)
|
||||
log.Error("Faile to mkdir:", err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
@@ -552,9 +552,10 @@ func DistributeSoftwareToNF(w http.ResponseWriter, r *http.Request) {
|
||||
fileName := (*neSoftware)[0]["file_name"]
|
||||
path := (*neSoftware)[0]["path"]
|
||||
srcFile := fmt.Sprintf("%s/%s", path, fileName)
|
||||
dstDir := fmt.Sprintf("%s@%s:%s/software/%s", config.GetYamlConfig().NE.User,
|
||||
neInfo.Ip, config.GetYamlConfig().NE.OmcDir, neTypeLower)
|
||||
cmd = exec.Command("scp", "-r", srcFile, dstDir)
|
||||
|
||||
scpDir := fmt.Sprintf("%s@%s:%s", config.GetYamlConfig().NE.User,
|
||||
neInfo.Ip, config.GetYamlConfig().NE.ScpDir)
|
||||
cmd = exec.Command("scp", "-r", srcFile, scpDir)
|
||||
out, err = cmd.CombinedOutput()
|
||||
log.Tracef("Exec output: %v", string(out))
|
||||
if err != nil {
|
||||
@@ -562,6 +563,17 @@ func DistributeSoftwareToNF(w http.ResponseWriter, r *http.Request) {
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
neFilePath := config.GetYamlConfig().NE.ScpDir + "/" + fileName
|
||||
cpCmd := fmt.Sprintf("sudo cp -f %s %s/software/%s", neFilePath,
|
||||
config.GetYamlConfig().NE.OmcDir, neTypeLower)
|
||||
cmd = exec.Command("ssh", sshHost, cpCmd)
|
||||
out, err = cmd.CombinedOutput()
|
||||
log.Tracef("Exec output: %v", string(out))
|
||||
if err != nil {
|
||||
log.Error("Faile to execute cp command:", err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
if len(*neVersion) == 0 {
|
||||
neVersionData := dborm.NeVersion{
|
||||
|
||||
Reference in New Issue
Block a user