fix: dpkg ims software
This commit is contained in:
@@ -698,8 +698,21 @@ func ActiveSoftwareToNF(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else if fileType == 2 {
|
} else if fileType == 2 {
|
||||||
dpkgCmd := fmt.Sprintf("sudo dpkg -i --force-all '%s'", filePath)
|
srcFile := fmt.Sprintf("%s/spawndpkg.sh", config.GetYamlConfig().OMC.BinDir)
|
||||||
err := RunSSHCmd(sshHost, dpkgCmd)
|
|
||||||
|
scpDir := fmt.Sprintf("%s@%s:%s", config.GetYamlConfig().NE.User,
|
||||||
|
neInfo.Ip, config.GetYamlConfig().NE.ScpDir)
|
||||||
|
cmd := exec.Command("scp", "-r", srcFile, scpDir)
|
||||||
|
out, err := cmd.CombinedOutput()
|
||||||
|
log.Debugf("Exec output: %v", string(out))
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("Faile to scp NF: neType=%s, neId=%s, ip=%s", neType, neId, neInfo.Ip)
|
||||||
|
services.ResponseInternalServerError500ProcessError(w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
dpkgCmd := fmt.Sprintf("sudo %s/spawdpkg.sh -i --force-all '%s'",
|
||||||
|
config.GetYamlConfig().NE.ScpDir, filePath)
|
||||||
|
err = RunSSHCmd(sshHost, dpkgCmd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Faile to execute dpkg command:", err)
|
log.Error("Faile to execute dpkg command:", err)
|
||||||
services.ResponseInternalServerError500ProcessError(w, err)
|
services.ResponseInternalServerError500ProcessError(w, err)
|
||||||
|
|||||||
9
misc/spawndpkg.sh
Normal file
9
misc/spawndpkg.sh
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
expect <<EOF
|
||||||
|
set timeout 10
|
||||||
|
spawn dpkg -i --force-all ${2}
|
||||||
|
expect {
|
||||||
|
"y/n" { send "${1}\n";exp_continue }
|
||||||
|
}
|
||||||
|
EOF
|
||||||
@@ -123,6 +123,7 @@ type YamlConfig struct {
|
|||||||
LicenseDir string `yaml:"licensedir"`
|
LicenseDir string `yaml:"licensedir"`
|
||||||
EtcListIMS string `yaml:"etcListIMS"`
|
EtcListIMS string `yaml:"etcListIMS"`
|
||||||
EtcListDefault string `yaml:"etcListDefault"`
|
EtcListDefault string `yaml:"etcListDefault"`
|
||||||
|
DpkgOverwrite bool `yaml:"dpkgOverwrite"`
|
||||||
} `yaml:"ne"`
|
} `yaml:"ne"`
|
||||||
|
|
||||||
Auth struct {
|
Auth struct {
|
||||||
|
|||||||
@@ -87,6 +87,8 @@ ne:
|
|||||||
# backup etc list of IMS,no space
|
# backup etc list of IMS,no space
|
||||||
etcListIMS: '{*.yaml,mmtel,vars.cfg}'
|
etcListIMS: '{*.yaml,mmtel,vars.cfg}'
|
||||||
etcListDefault: '{*.yaml,*.conf,*.cfg}'
|
etcListDefault: '{*.yaml,*.conf,*.cfg}'
|
||||||
|
# true/false to overwrite config file when dpkg ne software
|
||||||
|
dpkgOverwrite: true
|
||||||
|
|
||||||
# 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