diff --git a/pkg/util/helpers.go b/pkg/util/helpers.go index 84cba0a9..25f9d6b7 100644 --- a/pkg/util/helpers.go +++ b/pkg/util/helpers.go @@ -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"]) } diff --git a/pkg/util/helpers_test.go b/pkg/util/helpers_test.go index 7e7d84d1..e3642d33 100644 --- a/pkg/util/helpers_test.go +++ b/pkg/util/helpers_test.go @@ -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", diff --git a/pkg/util/testdata/os-release-rhel b/pkg/util/testdata/os-release-rhel new file mode 100644 index 00000000..a8c873a3 --- /dev/null +++ b/pkg/util/testdata/os-release-rhel @@ -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"