Fix error when technology couldn't be determined
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
dab9b52953
commit
7f8ed1c018
@ -2,7 +2,6 @@ package containers
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
@ -173,7 +172,14 @@ func getTechAndVersion(symlink string) (*TechInfo, error) {
|
||||
re := regexp.MustCompile(`\d+\.\d+\.\d+`)
|
||||
version := re.FindString(parts[1])
|
||||
if version == "" {
|
||||
return nil, errors.New("failed to extract version from symlink")
|
||||
// In case version couldn't be determined we return "unknown", otherwise returning
|
||||
// error in this case was crashing admin when user fucked up the symlink for the
|
||||
// tech manually.
|
||||
log.Println("failed to extract version from symlink")
|
||||
return &TechInfo{
|
||||
Tech: "unknown",
|
||||
Version: "",
|
||||
}, nil
|
||||
}
|
||||
|
||||
return &TechInfo{
|
||||
|
Loading…
Reference in New Issue
Block a user