Merge pull request #424 from stpabhi/rhel-support

Add rhel support for osversion
This commit is contained in:
Kubernetes Prow Robot
2020-04-15 14:30:45 -07:00
committed by GitHub
3 changed files with 23 additions and 0 deletions
+2
View File
@@ -91,6 +91,8 @@ func GetOSVersion() (string, error) {
return getDebianVersion(osReleaseMap), nil
case "centos":
return getDebianVersion(osReleaseMap), nil
case "rhel":
return getDebianVersion(osReleaseMap), nil
default:
return "", fmt.Errorf("Unsupported ID in /etc/os-release: %q", osReleaseMap["ID"])
}
+6
View File
@@ -167,6 +167,12 @@ func TestGetOSVersion(t *testing.T) {
expectedOSVersion: "centos 7 (Core)",
expectErr: false,
},
{
name: "rhel",
fakeOSReleasePath: "testdata/os-release-rhel",
expectedOSVersion: "rhel 7.7 (Maipo)",
expectErr: false,
},
{
name: "Unknown",
fakeOSReleasePath: "testdata/os-release-unknown",
+15
View File
@@ -0,0 +1,15 @@
NAME="Red Hat Enterprise Linux Server"
VERSION="7.7 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="7.7"
PRETTY_NAME="Red Hat Enterprise Linux Server 7.7 (Maipo)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.7:GA:server"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
REDHAT_BUGZILLA_PRODUCT_VERSION=7.7
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="7.7"