Skip to content

Commit

Permalink
cluster: fix and optimize os version check (#1336)
Browse files Browse the repository at this point in the history
  • Loading branch information
AstroProfundis authored May 6, 2021
1 parent c7536d9 commit a3b54e8
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions pkg/cluster/operation/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,35 @@ func checkOSInfo(opt *CheckOptions, osInfo *sysinfo.OS) *CheckResult {

// check OS vendor
switch osInfo.Vendor {
case "centos", "redhat":
case "centos", "redhat", "rhel":
// check version
if ver, _ := strconv.Atoi(osInfo.Version); ver < 7 {
result.Err = fmt.Errorf("%s %s not supported, use version 7 or higher",
osInfo.Name, osInfo.Release)
return result
}
case "debian", "ubuntu":
// check version
case "debian":
// debian support is not fully tested, but we suppose it should work
msg := "debian support is not fully tested, be careful"
result.Err = fmt.Errorf("%s (%s)", result.Msg, msg)
result.Warn = true
if ver, _ := strconv.Atoi(osInfo.Version); ver < 9 {
result.Err = fmt.Errorf("%s %s not supported, use version 9 or higher (%s)",
osInfo.Name, osInfo.Release, msg)
result.Warn = false
return result
}
case "ubuntu":
// ubuntu support is not fully tested, but we suppose it should work
msg := "ubuntu support is not fully tested, be careful"
result.Err = fmt.Errorf("%s (%s)", result.Msg, msg)
result.Warn = true
if ver, _ := strconv.ParseFloat(osInfo.Version, 64); ver < 18.04 {
result.Err = fmt.Errorf("%s %s not supported, use version 18.04 or higher (%s)",
osInfo.Name, osInfo.Release, msg)
result.Warn = false
return result
}
default:
result.Err = fmt.Errorf("os vendor %s not supported", osInfo.Vendor)
return result
Expand Down

0 comments on commit a3b54e8

Please sign in to comment.