merge: 合并代码
This commit is contained in:
@@ -55,11 +55,11 @@ func verify_signature(public_key_name string, source_cms_file string, source_fil
|
||||
func UploadSoftwareFile(w http.ResponseWriter, r *http.Request) {
|
||||
log.Debug("UploadSoftwareFile processing... ")
|
||||
|
||||
_, err := services.CheckFrontValidRequest(w, r)
|
||||
if err != nil {
|
||||
log.Error("Http request error:", err)
|
||||
return
|
||||
}
|
||||
// _, err := services.CheckFrontValidRequest(w, r)
|
||||
// if err != nil {
|
||||
// log.Error("Http request error:", err)
|
||||
// return
|
||||
// }
|
||||
|
||||
vars := mux.Vars(r)
|
||||
neType := vars["neType"]
|
||||
@@ -191,11 +191,11 @@ func UploadSoftwareFile(w http.ResponseWriter, r *http.Request) {
|
||||
func UploadSoftwareMultiFile(w http.ResponseWriter, r *http.Request) {
|
||||
log.Info("UploadSoftwareMultiFile processing... ")
|
||||
|
||||
_, err := services.CheckFrontValidRequest(w, r)
|
||||
if err != nil {
|
||||
log.Error("Http request error:", err)
|
||||
return
|
||||
}
|
||||
// _, err := services.CheckFrontValidRequest(w, r)
|
||||
// if err != nil {
|
||||
// log.Error("Http request error:", err)
|
||||
// return
|
||||
// }
|
||||
|
||||
vars := mux.Vars(r)
|
||||
neType := vars["neType"]
|
||||
@@ -213,10 +213,21 @@ func UploadSoftwareMultiFile(w http.ResponseWriter, r *http.Request) {
|
||||
services.ResponseNotFound404UriNotExist(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
sql := fmt.Sprintf("select * from ne_software where ne_type='%s' and version='%s'", neTypeUpper, version)
|
||||
neSoftwareInfo, _ := dborm.XormGetDataBySQL(sql)
|
||||
if len(*neSoftwareInfo) >= 1 {
|
||||
services.ResponseWithJson(w, 200, map[string]any{
|
||||
"code": 0,
|
||||
"msg": "Software version already exists",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
md5Param := services.GetUriParamString(r, "md5Sum", ",", false, false)
|
||||
|
||||
softwarePath := fmt.Sprintf("%s/%s", config.GetYamlConfig().OMC.Software, neTypeLower)
|
||||
err = os.MkdirAll(softwarePath, os.ModePerm)
|
||||
err := os.MkdirAll(softwarePath, os.ModePerm)
|
||||
if err != nil {
|
||||
log.Error("Failed to Mkdir:", err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
@@ -372,11 +383,11 @@ func UploadSoftwareMultiFile(w http.ResponseWriter, r *http.Request) {
|
||||
func DownloadSoftwareFile(w http.ResponseWriter, r *http.Request) {
|
||||
log.Debug("DownloadSoftwareFile processing... ")
|
||||
|
||||
_, err := services.CheckFrontValidRequest(w, r)
|
||||
if err != nil {
|
||||
log.Error("Request error:", err)
|
||||
return
|
||||
}
|
||||
// _, err := services.CheckFrontValidRequest(w, r)
|
||||
// if err != nil {
|
||||
// log.Error("Request error:", err)
|
||||
// return
|
||||
// }
|
||||
|
||||
vars := mux.Vars(r)
|
||||
neType := vars["neType"]
|
||||
@@ -418,11 +429,11 @@ func DownloadSoftwareFile(w http.ResponseWriter, r *http.Request) {
|
||||
func DeleteSoftwareFile(w http.ResponseWriter, r *http.Request) {
|
||||
log.Debug("DeleteSoftwareFile processing... ")
|
||||
|
||||
_, err := services.CheckFrontValidRequest(w, r)
|
||||
if err != nil {
|
||||
log.Error("Request error:", err)
|
||||
return
|
||||
}
|
||||
// _, err := services.CheckFrontValidRequest(w, r)
|
||||
// if err != nil {
|
||||
// log.Error("Request error:", err)
|
||||
// return
|
||||
// }
|
||||
|
||||
vars := mux.Vars(r)
|
||||
neType := vars["neType"]
|
||||
@@ -478,11 +489,11 @@ func DeleteSoftwareFile(w http.ResponseWriter, r *http.Request) {
|
||||
func DistributeSoftwareToNF(w http.ResponseWriter, r *http.Request) {
|
||||
log.Debug("DistributeSoftwareFile processing... ")
|
||||
|
||||
_, err := services.CheckFrontValidRequest(w, r)
|
||||
if err != nil {
|
||||
log.Error("Http request error:", err)
|
||||
return
|
||||
}
|
||||
// _, err := services.CheckFrontValidRequest(w, r)
|
||||
// if err != nil {
|
||||
// log.Error("Http request error:", err)
|
||||
// return
|
||||
// }
|
||||
|
||||
vars := mux.Vars(r)
|
||||
neType := vars["neType"]
|
||||
@@ -618,11 +629,11 @@ func DistributeSoftwareToNF(w http.ResponseWriter, r *http.Request) {
|
||||
func ActiveSoftwareToNF(w http.ResponseWriter, r *http.Request) {
|
||||
log.Debug("ActiveSoftwareToNF processing... ")
|
||||
|
||||
_, err := services.CheckFrontValidRequest(w, r)
|
||||
if err != nil {
|
||||
log.Error("Http request error:", err)
|
||||
return
|
||||
}
|
||||
// _, err := services.CheckFrontValidRequest(w, r)
|
||||
// if err != nil {
|
||||
// log.Error("Http request error:", err)
|
||||
// return
|
||||
// }
|
||||
|
||||
vars := mux.Vars(r)
|
||||
neType := vars["neType"]
|
||||
@@ -825,11 +836,11 @@ func ActiveSoftwareToNF(w http.ResponseWriter, r *http.Request) {
|
||||
func RollBackSoftwareToNF(w http.ResponseWriter, r *http.Request) {
|
||||
log.Debug("ActiveSoftwareToNF processing... ")
|
||||
|
||||
_, err := services.CheckFrontValidRequest(w, r)
|
||||
if err != nil {
|
||||
log.Error("Http request error:", err)
|
||||
return
|
||||
}
|
||||
// _, err := services.CheckFrontValidRequest(w, r)
|
||||
// if err != nil {
|
||||
// log.Error("Http request error:", err)
|
||||
// return
|
||||
// }
|
||||
|
||||
vars := mux.Vars(r)
|
||||
neType := vars["neType"]
|
||||
@@ -919,7 +930,7 @@ func RollBackSoftwareToNF(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
services.ResponseStatusOK204NoContent(w)
|
||||
RunSSHCmd(sshHost, runCmd)
|
||||
go RunSSHCmd(sshHost, runCmd)
|
||||
return
|
||||
}
|
||||
err = RunSSHCmd(sshHost, runCmd)
|
||||
|
||||
Reference in New Issue
Block a user