restart ne
This commit is contained in:
@@ -145,7 +145,7 @@ func PostNeInfo(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
log.Info("StatusCode: ", response.StatusCode())
|
||||
|
||||
if config.GetYamlConfig().OMC.Chk2Ne == false {
|
||||
if !config.GetYamlConfig().OMC.Chk2Ne {
|
||||
affected, err := dborm.XormInsertNeInfo(neInfo)
|
||||
if err != nil {
|
||||
log.Error("Failed to insert Ne info:", err)
|
||||
@@ -243,7 +243,7 @@ func PutNeInfo(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
log.Info("StatusCode: ", response.StatusCode())
|
||||
|
||||
if config.GetYamlConfig().OMC.Chk2Ne == false {
|
||||
if !config.GetYamlConfig().OMC.Chk2Ne {
|
||||
affected, err := dborm.XormUpdateNeInfo(neInfo)
|
||||
if err != nil {
|
||||
log.Error("Failed to update Ne info:", err)
|
||||
@@ -319,7 +319,7 @@ func DeleteNeInfo(w http.ResponseWriter, r *http.Request) {
|
||||
log.Debug("NE info:", neInfo)
|
||||
|
||||
// if NE in active status, can't delete NE
|
||||
if IsActiveNF(neInfo) == false {
|
||||
if !IsActiveNF(neInfo) {
|
||||
affected, err := dborm.XormDeleteNeInfo(neInfo)
|
||||
if err != nil {
|
||||
log.Error("Failed to delete Ne info:", err)
|
||||
@@ -336,7 +336,6 @@ func DeleteNeInfo(w http.ResponseWriter, r *http.Request) {
|
||||
err = global.ErrCMCannotDeleteActiveNE
|
||||
log.Error(err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
func IsActiveNF(neInfo *dborm.NeInfo) bool {
|
||||
|
||||
@@ -632,7 +632,7 @@ func ActiveSoftwareToNF(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
neTypeUpper := strings.ToUpper(neType)
|
||||
//neTypeLower := strings.ToLower(neType)
|
||||
neTypeLower := strings.ToLower(neType)
|
||||
|
||||
version := vars["version"]
|
||||
if version == "" {
|
||||
@@ -691,7 +691,7 @@ func ActiveSoftwareToNF(w http.ResponseWriter, r *http.Request) {
|
||||
rpmCmd := fmt.Sprintf("sudo rpm -Uvh '%s'", filePath)
|
||||
cmd := exec.Command("ssh", sshHost, rpmCmd)
|
||||
out, err := cmd.CombinedOutput()
|
||||
log.Tracef("Exec output: %v", string(out))
|
||||
log.Debugf("Exec output: %v", string(out))
|
||||
if err != nil {
|
||||
log.Error("Faile to execute rpm command:", err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
@@ -701,7 +701,7 @@ func ActiveSoftwareToNF(w http.ResponseWriter, r *http.Request) {
|
||||
dpkgCmd := fmt.Sprintf("sudo dpkg -i '%s'", filePath)
|
||||
cmd := exec.Command("ssh", sshHost, dpkgCmd)
|
||||
out, err := cmd.CombinedOutput()
|
||||
log.Tracef("Exec output: %v", string(out))
|
||||
log.Debugf("Exec output: %v", string(out))
|
||||
if err != nil {
|
||||
log.Error("Faile to execute dpkg command:", err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
@@ -713,6 +713,27 @@ func ActiveSoftwareToNF(w http.ResponseWriter, r *http.Request) {
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
if neTypeLower != "omc" {
|
||||
restartCmd := fmt.Sprintf("sudo systemctl restart %s.service", neTypeLower)
|
||||
cmd := exec.Command("ssh", sshHost, restartCmd)
|
||||
out, err := cmd.CombinedOutput()
|
||||
log.Debugf("Exec output: %v", string(out))
|
||||
if err != nil {
|
||||
log.Error("Faile to execute ssh sudo systemctl command:", err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
restartCmd := fmt.Sprintf("sudo %s/bin/omcsvc.sh restart", config.GetYamlConfig().NE.OmcDir)
|
||||
cmd := exec.Command("ssh", sshHost, restartCmd)
|
||||
out, err := cmd.CombinedOutput()
|
||||
log.Debugf("Exec output: %v", string(out))
|
||||
if err != nil {
|
||||
log.Error("Faile to execute ssh restart omc:", err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
idNeVersion, _ := strconv.Atoi((*neVersion)[0]["id"])
|
||||
|
||||
@@ -7,7 +7,7 @@ else
|
||||
echo "id_rsa has created ..."
|
||||
fi
|
||||
|
||||
#分发到各个节点,这里分发到ne-hosts文件中的主机中.
|
||||
#分发到各个节点,这里分发到nehosts文件中的主机中.
|
||||
while read line
|
||||
do
|
||||
user=`echo $line | cut -d " " -f 2`
|
||||
|
||||
Reference in New Issue
Block a user