diff --git a/pkg/util/helpers_linux.go b/pkg/util/helpers_linux.go index 736a973f..425e1fa8 100644 --- a/pkg/util/helpers_linux.go +++ b/pkg/util/helpers_linux.go @@ -56,6 +56,8 @@ func getOSVersion(osReleasePath string) (string, error) { return getDebianVersion(osReleaseMap), nil case "centos": return getDebianVersion(osReleaseMap), nil + case "rocky": + return getDebianVersion(osReleaseMap), nil case "rhel": return getDebianVersion(osReleaseMap), nil case "ol": diff --git a/pkg/util/helpers_linux_test.go b/pkg/util/helpers_linux_test.go index ca28637c..7eda0d96 100644 --- a/pkg/util/helpers_linux_test.go +++ b/pkg/util/helpers_linux_test.go @@ -51,6 +51,12 @@ func TestGetOSVersionLinux(t *testing.T) { expectedOSVersion: "centos 7 (Core)", expectErr: false, }, + { + name: "rocky", + fakeOSReleasePath: "testdata/os-release-rocky", + expectedOSVersion: "rocky 8.5 (Green Obsidian)", + expectErr: false, + }, { name: "rhel", fakeOSReleasePath: "testdata/os-release-rhel", diff --git a/pkg/util/testdata/os-release-rocky b/pkg/util/testdata/os-release-rocky new file mode 100644 index 00000000..04c3f9a6 --- /dev/null +++ b/pkg/util/testdata/os-release-rocky @@ -0,0 +1,13 @@ +NAME="Rocky Linux" +VERSION="8.5 (Green Obsidian)" +ID="rocky" +ID_LIKE="rhel centos fedora" +VERSION_ID="8.5" +PLATFORM_ID="platform:el8" +PRETTY_NAME="Rocky Linux 8.5 (Green Obsidian)" +ANSI_COLOR="0;32" +CPE_NAME="cpe:/o:rocky:rocky:8.5:GA" +HOME_URL="https://rockylinux.org/" +BUG_REPORT_URL="https://bugs.rockylinux.org/" +ROCKY_SUPPORT_PRODUCT="Rocky Linux" +ROCKY_SUPPORT_PRODUCT_VERSION="8"