Merge pull request #13 from yoavrotems/patch-6

gets also ubuntu version
This commit is contained in:
Liz Rice 2019-05-30 12:10:44 +02:00 committed by GitHub
commit 1e3435556e
Failed to generate hash of commit

View file

@ -102,13 +102,14 @@ func GetLSM() (lsm string, err error) {
}
func getPlatformVersion(output, platform string) string {
flagRe := regexp.MustCompile("version_id" + `=([^ \n]*)`)
flagRe := regexp.MustCompile(`version[_id]*=([^ \n]*)`)
vals := flagRe.FindStringSubmatch(output)
if len(vals) > 1 {
switch platform {
case "rhel":
return vals[1][:1] // Get the major version only, examaple: 7.6 will return 7
case "ubuntu":
return vals[1][:2] // Get the major version only, examaple: 18.04 will return 18
default:
return ""
}