Fix cases where /opt/techs doesn't exist
This commit is contained in:
parent
fea1a46a11
commit
29866d0e75
1 changed files with 14 additions and 2 deletions
|
@ -2,6 +2,7 @@ package containers
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"path"
|
||||
"strings"
|
||||
|
@ -340,7 +341,18 @@ func (c *Container) GetTechs() (apps.AppTechs, error) {
|
|||
|
||||
driver := c.getDriver()
|
||||
|
||||
stdouterr, err := driver.Exec(c.App.Name, []string{"ls", "/opt/techs"}, "", []string{}, true)
|
||||
stdouterr, err := driver.Exec(c.App.Name, []string{"ls", "/opt"}, "", []string{}, true)
|
||||
if err != nil {
|
||||
// in case there is an error just return empty response
|
||||
return techs, nil
|
||||
}
|
||||
|
||||
// Check if /opt/techs exists
|
||||
if !strings.Contains(string(*stdouterr), "techs") {
|
||||
return techs, nil
|
||||
}
|
||||
|
||||
stdouterr, err = driver.Exec(c.App.Name, []string{"ls", "/opt/techs"}, "", []string{}, true)
|
||||
if err != nil {
|
||||
// in case there is an error just return empty response
|
||||
return techs, nil
|
||||
|
@ -360,7 +372,7 @@ func (c *Container) GetTechs() (apps.AppTechs, error) {
|
|||
Version: techParts[1],
|
||||
})
|
||||
} else {
|
||||
return techs, errors.New("one of the tech has wrong number of parts")
|
||||
return techs, fmt.Errorf("one of the tech has wrong number of parts (%s)", techRaw)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue