fix: ims etc backup list
This commit is contained in:
@@ -423,7 +423,13 @@ func ExportCmFromNF(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
var scpCmd string
|
var scpCmd string
|
||||||
ipType := global.ParseIPAddr(neInfo.Ip)
|
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 {
|
if ipType == global.IsIPv4 {
|
||||||
scpCmd = fmt.Sprintf("scp -r %s@%s:%s/%s/*.yaml %s/etc/%s", config.GetYamlConfig().NE.User,
|
scpCmd = fmt.Sprintf("scp -r %s@%s:%s/%s/*.yaml %s/etc/%s", config.GetYamlConfig().NE.User,
|
||||||
neInfo.Ip, config.GetYamlConfig().NE.EtcDir,
|
neInfo.Ip, config.GetYamlConfig().NE.EtcDir,
|
||||||
@@ -433,7 +439,17 @@ func ExportCmFromNF(w http.ResponseWriter, r *http.Request) {
|
|||||||
neInfo.Ip, config.GetYamlConfig().NE.EtcDir,
|
neInfo.Ip, config.GetYamlConfig().NE.EtcDir,
|
||||||
neTypeLower, config.GetYamlConfig().OMC.Backup, neTypeLower)
|
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 {
|
if ipType == global.IsIPv4 {
|
||||||
scpCmd = fmt.Sprintf("scp -r %s@%s:%s/etc/*.yaml %s/etc/%s", config.GetYamlConfig().NE.User,
|
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)
|
neInfo.Ip, config.GetYamlConfig().NE.OmcDir, config.GetYamlConfig().OMC.Backup, neTypeLower)
|
||||||
|
|||||||
@@ -698,7 +698,7 @@ func ActiveSoftwareToNF(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else if fileType == 2 {
|
} else if fileType == 2 {
|
||||||
dpkgCmd := fmt.Sprintf("sudo dpkg -i '%s'", filePath)
|
dpkgCmd := fmt.Sprintf("sudo dpkg -i --force-all '%s'", filePath)
|
||||||
cmd := exec.Command("ssh", sshHost, dpkgCmd)
|
cmd := exec.Command("ssh", sshHost, dpkgCmd)
|
||||||
out, err := cmd.CombinedOutput()
|
out, err := cmd.CombinedOutput()
|
||||||
log.Debugf("Exec output: %v", string(out))
|
log.Debugf("Exec output: %v", string(out))
|
||||||
@@ -744,7 +744,6 @@ func ActiveSoftwareToNF(w http.ResponseWriter, r *http.Request) {
|
|||||||
services.ResponseInternalServerError500ProcessError(w, err)
|
services.ResponseInternalServerError500ProcessError(w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -839,7 +838,7 @@ func RollBackSoftwareToNF(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else if fileType == 2 {
|
} else if fileType == 2 {
|
||||||
dpkgCmd := fmt.Sprintf("sudo dpkg -i '%s'", filePath)
|
dpkgCmd := fmt.Sprintf("sudo dpkg -i --force-all '%s'", filePath)
|
||||||
cmd := exec.Command("ssh", sshHost, dpkgCmd)
|
cmd := exec.Command("ssh", sshHost, dpkgCmd)
|
||||||
out, err := cmd.CombinedOutput()
|
out, err := cmd.CombinedOutput()
|
||||||
log.Debugf("Exec output: %v", string(out))
|
log.Debugf("Exec output: %v", string(out))
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ type YamlConfig struct {
|
|||||||
OmcDir string `yaml:"omcdir"`
|
OmcDir string `yaml:"omcdir"`
|
||||||
ScpDir string `yaml:"scpdir"`
|
ScpDir string `yaml:"scpdir"`
|
||||||
LicenseDir string `yaml:"licensedir"`
|
LicenseDir string `yaml:"licensedir"`
|
||||||
|
EtcListIMS string `yaml:"etcListIMS"`
|
||||||
} `yaml:"ne"`
|
} `yaml:"ne"`
|
||||||
|
|
||||||
Auth struct {
|
Auth struct {
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ mml:
|
|||||||
mmlHome: ./mmlhome
|
mmlHome: ./mmlhome
|
||||||
upload: /home/agtuser
|
upload: /home/agtuser
|
||||||
|
|
||||||
|
# NE config
|
||||||
ne:
|
ne:
|
||||||
user: root
|
user: root
|
||||||
etcdir: /usr/local/etc
|
etcdir: /usr/local/etc
|
||||||
@@ -76,6 +77,8 @@ ne:
|
|||||||
omcdir: /usr/local/omc
|
omcdir: /usr/local/omc
|
||||||
scpdir: /tmp
|
scpdir: /tmp
|
||||||
licensedir: /usr/local/etc/{neType}/license
|
licensedir: /usr/local/etc/{neType}/license
|
||||||
|
# backup etc list of IMS
|
||||||
|
etcListIMS: '{*.yaml,mmtel,vars.cfg}'
|
||||||
|
|
||||||
# chk2ne: true/false, if put OmcNeConfig parameters to NE
|
# chk2ne: true/false, if put OmcNeConfig parameters to NE
|
||||||
omc:
|
omc:
|
||||||
|
|||||||
Reference in New Issue
Block a user