Potential fix of set tech in the container + logging
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is passing Details

This commit is contained in:
Adam Štrauch 2022-06-15 20:16:20 +02:00
parent 61adbd7a28
commit 5caa570055
Signed by: cx
GPG Key ID: 018304FFA8988F8D
2 changed files with 11 additions and 2 deletions

View File

@ -263,11 +263,15 @@ func (c *Container) SetTechnology(tech string, version string) error {
var err error
// TODO: script injection here?
var output *[]byte
if version == "" {
_, err = driver.Exec(c.App.Name, []string{"su", "app", "-c", "rosti " + tech}, "", []string{}, false)
output, err = driver.Exec(c.App.Name, []string{"su", "app", "-c", "rosti " + tech}, "", []string{}, false)
} else {
_, err = driver.Exec(c.App.Name, []string{"su", "app", "-c", "rosti " + tech + " " + version}, "", []string{}, false)
output, err = driver.Exec(c.App.Name, []string{"su", "app", "-c", "rosti " + tech + " " + version}, "", []string{}, false)
}
log.Printf("DEBUG: enable tech for %s output: %s", c.App.Name, string(*output))
return err
}

View File

@ -15,6 +15,9 @@ import (
"github.com/rosti-cz/node-api/node"
)
// Wait for the container a little bit longer
const ENABLE_TECH_WAIT = 10
// Processor separates logic of apps, containers, detector and node from handlers.
// It defines common interface for both types of handlers, HTTP and the events.
type Processor struct {
@ -455,6 +458,8 @@ func (p *Processor) EnableTech(service, version string) error {
return err
}
time.Sleep(ENABLE_TECH_WAIT * time.Second)
container, err := p.getContainer()
if err != nil {
return err