func newLinuxRelease()

in cli_tools/common/distro/distro.go [151:187]


func newLinuxRelease(distro string, major string, minor string) (Release, error) {
	majorInt, e := strconv.Atoi(major)
	if e != nil || majorInt < 1 {
		return nil, fmt.Errorf(
			"major version required to be an integer greater than zero. Received: `%s`", major)
	}
	var minorInt int
	if minor == "" {
		minorInt = 0
	} else {
		minorInt, e = strconv.Atoi(minor)
		if e != nil || minorInt < 0 {
			return nil, errors.New(
				"minor version required to be an integer greater than or equal to zero. Received: " + minor)
		}
	}
	switch distro {
	case ubuntu:
		return newUbuntuRelease(majorInt, minorInt)
	case centos:
		fallthrough
	case debian:
		fallthrough
	case opensuse:
		fallthrough
	case rhel:
		fallthrough
	case rocky:
		return newCommonLinuxRelease(distro, majorInt, minorInt)
	case sles:
		fallthrough
	case slesSAP:
		return newSLESRelease(distro, majorInt, minorInt)
	default:
		return nil, fmt.Errorf("Unrecognized distro `%s`", distro)
	}
}