Support RHEL5

This commit is contained in:
Kota Kanbe
2017-01-06 13:31:10 +09:00
parent 62d1b761bd
commit 63dfe8a952
4 changed files with 52 additions and 54 deletions

View File

@@ -20,6 +20,7 @@ package config
import (
"fmt"
"runtime"
"strconv"
"strings"
log "github.com/Sirupsen/logrus"
@@ -369,6 +370,16 @@ func (l Distro) String() string {
return fmt.Sprintf("%s %s", l.Family, l.Release)
}
// MajorVersion returns Major version
func (l Distro) MajorVersion() (ver int, err error) {
if 0 < len(l.Release) {
ver, err = strconv.Atoi(strings.Split(l.Release, ".")[0])
} else {
err = fmt.Errorf("Release is empty")
}
return
}
// IsContainer returns whether this ServerInfo is about container
func (s ServerInfo) IsContainer() bool {
return 0 < len(s.Container.ContainerID)