fix: dpkg software issue
This commit is contained in:
@@ -89,6 +89,8 @@ ne:
|
||||
etcListDefault: '{*.yaml,*.conf,*.cfg}'
|
||||
# true/false to overwrite config file when dpkg ne software
|
||||
dpkgOverwrite: false
|
||||
# dpkg timeout (second)
|
||||
dpkgTimeout: 180
|
||||
|
||||
# chk2ne: true/false, if put OmcNeConfig parameters to NE
|
||||
omc:
|
||||
|
||||
@@ -710,11 +710,15 @@ func ActiveSoftwareToNF(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
var inputStr string = "n"
|
||||
var timeout int = 180
|
||||
if config.GetYamlConfig().NE.DpkgOverwrite {
|
||||
inputStr = "y"
|
||||
}
|
||||
dpkgCmd := fmt.Sprintf("sudo %s/spawndpkg.sh %s '%s'",
|
||||
config.GetYamlConfig().NE.ScpDir, inputStr, filePath)
|
||||
if config.GetYamlConfig().NE.DpkgTimeout != 0 {
|
||||
timeout = config.GetYamlConfig().NE.DpkgTimeout
|
||||
}
|
||||
dpkgCmd := fmt.Sprintf("sudo %s/spawndpkg.sh %d %s '%s'",
|
||||
config.GetYamlConfig().NE.ScpDir, timeout, inputStr, filePath)
|
||||
err = RunSSHCmd(sshHost, dpkgCmd)
|
||||
if err != nil {
|
||||
log.Errorf("Faile to execute dpkg command: %s, error: %v", dpkgCmd, err)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
expect <<EOF
|
||||
set timeout 10
|
||||
spawn dpkg -i --force-all ${2}
|
||||
expect <<EOF
|
||||
set timeout ${1}
|
||||
spawn dpkg -i --force-all ${3}
|
||||
expect {
|
||||
"y/n" { send "${1}\n";exp_continue }
|
||||
"y/n" { send "${2}\n";exp_continue }
|
||||
}
|
||||
EOF
|
||||
@@ -124,6 +124,7 @@ type YamlConfig struct {
|
||||
EtcListIMS string `yaml:"etcListIMS"`
|
||||
EtcListDefault string `yaml:"etcListDefault"`
|
||||
DpkgOverwrite bool `yaml:"dpkgOverwrite"`
|
||||
DpkgTimeout int `yaml:"dpkgTimeout"`
|
||||
} `yaml:"ne"`
|
||||
|
||||
Auth struct {
|
||||
|
||||
@@ -89,6 +89,8 @@ ne:
|
||||
etcListDefault: '{*.yaml,*.conf,*.cfg}'
|
||||
# true/false to overwrite config file when dpkg ne software
|
||||
dpkgOverwrite: false
|
||||
# dpkg timeout (second)
|
||||
dpkgTimeout: 180
|
||||
|
||||
# chk2ne: true/false, if put OmcNeConfig parameters to NE
|
||||
omc:
|
||||
|
||||
Reference in New Issue
Block a user