fix: 网元配置文件复制到本地找不到文件夹
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
neService "nms_cxy/src/modules/network_element/service"
|
||||
"nms_cxy/src/modules/nms_cxy/model"
|
||||
"nms_cxy/src/modules/nms_cxy/utils/common"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -62,9 +63,14 @@ func (s *ConfigImpl) ConfigUploadOSS(neType string) error {
|
||||
|
||||
// 配置文件目录
|
||||
nePath := fmt.Sprintf("/usr/local/etc/%s/*.yaml", strings.ToLower(neType))
|
||||
localPath := fmt.Sprintf("/usr/local/omc/etc/%s/", strings.ToLower(neType))
|
||||
nePathTemp := fmt.Sprintf("/tmp/%s/config/", strings.ToLower(neType))
|
||||
localPath := fmt.Sprintf("/usr/local/etc/omc/ne_config/%s/config/", strings.ToLower(neType))
|
||||
if runtime.GOOS == "windows" {
|
||||
localPath = fmt.Sprintf("C:%s", localPath)
|
||||
}
|
||||
sshClient.RunCMD(fmt.Sprintf("mkdir -p %s && sudo cp -rf %s %s", nePathTemp, nePath, nePathTemp))
|
||||
// 复制到本地
|
||||
if err = sftpClient.CopyDirRemoteToLocal(nePath, localPath); err != nil {
|
||||
if err = sftpClient.CopyDirRemoteToLocal(nePathTemp, localPath); err != nil {
|
||||
logger.Errorf("%s : please check if scp remote copy is allowed", neInfo.NeType)
|
||||
return fmt.Errorf("copy config err")
|
||||
}
|
||||
@@ -464,7 +470,7 @@ func (s *ConfigImpl) ConfigParamModify(neInfo neModel.NeInfo, byUsername string,
|
||||
// 新增
|
||||
// if operType == "add" {}
|
||||
|
||||
// 操作记录推送 Kafka
|
||||
// 操作记录到数据库
|
||||
bytes, _ := json.Marshal(operPara)
|
||||
nowTime := time.Now()
|
||||
nrmLog := model.NRMLog{
|
||||
@@ -477,6 +483,7 @@ func (s *ConfigImpl) ConfigParamModify(neInfo neModel.NeInfo, byUsername string,
|
||||
ChangeOper: string(bytes),
|
||||
}
|
||||
nrmLogId := s.resourceService.ResourceeInsert(nrmLog)
|
||||
// 操作记录推入kafka
|
||||
if nrmLogId != "" {
|
||||
pushData := operPara
|
||||
pushData["MsgID"] = nrmLogId
|
||||
|
||||
Reference in New Issue
Block a user