Fix Amazon Linux 2 scanning (#630)

* fix(amazon2): fix OS version parse error
This commit is contained in:
Kota Kanbe
2018-04-10 11:53:11 +09:00
committed by GitHub
parent ce56261b52
commit 5076326589
2 changed files with 47 additions and 0 deletions

View File

@@ -664,6 +664,14 @@ func (l Distro) String() string {
// MajorVersion returns Major version
func (l Distro) MajorVersion() (ver int, err error) {
if l.Family == Amazon {
ss := strings.Fields(l.Release)
if len(ss) == 1 {
return 1, nil
}
ver, err = strconv.Atoi(ss[0])
return
}
if 0 < len(l.Release) {
ver, err = strconv.Atoi(strings.Split(l.Release, ".")[0])
} else {