1
0

feat: 合并代码

This commit is contained in:
TsMask
2023-10-27 09:40:53 +08:00
parent 08a908c3f4
commit 955aba902b
26 changed files with 1057 additions and 53 deletions

View File

@@ -423,7 +423,13 @@ func ExportCmFromNF(w http.ResponseWriter, r *http.Request) {
var scpCmd string
ipType := global.ParseIPAddr(neInfo.Ip)
if neTypeLower != "omc" {
omcNetypeLower := strings.ToLower(config.GetYamlConfig().OMC.NeType)
etcListIMS := "{*.yaml,mmtel,vars.cfg}"
if config.GetYamlConfig().NE.EtcListIMS != "" {
etcListIMS = config.GetYamlConfig().NE.EtcListIMS
}
switch neTypeLower {
case omcNetypeLower:
if ipType == global.IsIPv4 {
scpCmd = fmt.Sprintf("scp -r %s@%s:%s/%s/*.yaml %s/etc/%s", config.GetYamlConfig().NE.User,
neInfo.Ip, config.GetYamlConfig().NE.EtcDir,
@@ -433,7 +439,17 @@ func ExportCmFromNF(w http.ResponseWriter, r *http.Request) {
neInfo.Ip, config.GetYamlConfig().NE.EtcDir,
neTypeLower, config.GetYamlConfig().OMC.Backup, neTypeLower)
}
} else {
case "ims":
if ipType == global.IsIPv4 {
scpCmd = fmt.Sprintf("scp -r %s@%s:%s/%s/%s %s/etc/%s", config.GetYamlConfig().NE.User,
neInfo.Ip, config.GetYamlConfig().NE.EtcDir, neTypeLower,
etcListIMS, config.GetYamlConfig().OMC.Backup, neTypeLower)
} else {
scpCmd = fmt.Sprintf("scp -r %s@[%s]:%s/%s/%s %s/etc/%s", config.GetYamlConfig().NE.User,
neInfo.Ip, config.GetYamlConfig().NE.EtcDir, neTypeLower,
etcListIMS, config.GetYamlConfig().OMC.Backup, neTypeLower)
}
default:
if ipType == global.IsIPv4 {
scpCmd = fmt.Sprintf("scp -r %s@%s:%s/etc/*.yaml %s/etc/%s", config.GetYamlConfig().NE.User,
neInfo.Ip, config.GetYamlConfig().NE.OmcDir, config.GetYamlConfig().OMC.Backup, neTypeLower)