diff --git a/config/etc/default/restconf.yaml b/config/etc/default/restconf.yaml index 1a9a2cf3..923dd38e 100644 --- a/config/etc/default/restconf.yaml +++ b/config/etc/default/restconf.yaml @@ -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: diff --git a/features/cm/software.go b/features/cm/software.go index b52a7e34..3354c9fe 100644 --- a/features/cm/software.go +++ b/features/cm/software.go @@ -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) diff --git a/misc/spawndpkg.sh b/misc/spawndpkg.sh index 238b7df3..ed004c50 100644 --- a/misc/spawndpkg.sh +++ b/misc/spawndpkg.sh @@ -1,9 +1,9 @@ #!/bin/bash - expect <