fix: dpkg software issue

This commit is contained in:
simonzhangsz committed 2024-01-17 14:40:48 +08:00
1 parent 8eb6430ae3
commit 9e54ccd886
5 files changed
+15 -6

No files matched your search

+2
View File
@@ -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:
+6 -2
View File
@@ -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)
+4 -4
View File
@@ -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
+1
View File
@@ -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 {
+2
View File
@@ -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: