This commit is contained in:
2023-09-18 19:45:29 +08:00
parent 133342bd00
commit 71099844b6

View File

@@ -491,7 +491,7 @@ func ImportCmToNF(w http.ResponseWriter, r *http.Request) {
return
}
neTypeUpper := strings.ToUpper(neType)
//neTypeLower := strings.ToLower(neType)
neTypeLower := strings.ToLower(neType)
neId := services.GetUriParamString(r, "ne_id", ",", false, false)
@@ -616,7 +616,12 @@ func ImportCmToNF(w http.ResponseWriter, r *http.Request) {
return
}
neFilePath := config.GetYamlConfig().NE.ScpDir + "/" + fileName
unzipCmd := fmt.Sprintf("sudo unzip -o %s -d %s", neFilePath, config.GetYamlConfig().NE.EtcDir)
var unzipCmd string
if neTypeLower != "omc" {
unzipCmd = fmt.Sprintf("sudo unzip -o %s -d %s", neFilePath, config.GetYamlConfig().NE.EtcDir)
} else {
unzipCmd = fmt.Sprintf("sudo unzip -oj %s -d %s/etc", neFilePath, config.GetYamlConfig().NE.OmcDir)
}
sshHost := fmt.Sprintf("%s@%s", config.GetYamlConfig().NE.User, neInfo.Ip)
cmd := exec.Command("ssh", sshHost, unzipCmd)
out, err := cmd.CombinedOutput()