fix: 网元配置备份支持MME配置conf文件cp

This commit is contained in:
TsMask
2024-07-26 18:31:36 +08:00
parent 3b01d48a99
commit d8f97af7c0

View File

@@ -121,7 +121,11 @@ func (r *NeConfigBackupImpl) NeConfigLocalToNe(neInfo model.NeInfo, localFile st
sshClient.RunCMD(fmt.Sprintf("sudo mkdir -p /usr/local/etc/iwf && sudo cp -rf %s/iwf/* /usr/local/etc/iwf && sudo chmod 755 /usr/local/etc/iwf/*.yaml", neDirTemp))
} else {
neEtcPath := fmt.Sprintf("/usr/local/etc/%s", neTypeLower)
sshClient.RunCMD(fmt.Sprintf("sudo cp -rf %s/* %s && sudo chmod 755 %s/*.yaml", neDirTemp, neEtcPath, neEtcPath))
chmodFile := fmt.Sprintf("sudo chmod 755 %s/*.yaml", neEtcPath)
if neTypeLower == "mme" {
chmodFile = fmt.Sprintf("sudo chmod 755 %s/*.{yaml,conf}", neEtcPath)
}
sshClient.RunCMD(fmt.Sprintf("sudo cp -rf %s/* %s && %s", neDirTemp, neEtcPath, chmodFile))
}
_ = os.RemoveAll(localDirPath) // 删除本地临时目录
@@ -170,6 +174,9 @@ func (r *NeConfigBackupImpl) NeConfigNeToLocal(neInfo model.NeInfo) (string, err
sshClient.RunCMD(fmt.Sprintf("mkdir -p %s/iwf && sudo cp -rf /usr/local/etc/iwf/*.yaml %s/iwf", neDirTemp, neDirTemp))
} else {
nePath := fmt.Sprintf("/usr/local/etc/%s/*.yaml", neTypeLower)
if neTypeLower == "mme" {
nePath = fmt.Sprintf("/usr/local/etc/%s/*.{yaml,conf}", neTypeLower)
}
sshClient.RunCMD(fmt.Sprintf("mkdir -p %s && sudo cp -rf %s %s", neDirTemp, nePath, neDirTemp))
}