Add rocky linux support to GetOSVersion

This commit is contained in:
Sudheer Nedlumane
2024-05-15 16:48:25 -07:00
parent f39c93e0f4
commit 7ee2a4dcda
3 changed files with 21 additions and 0 deletions
+2
View File
@@ -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":
+6
View File
@@ -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",
+13
View File
@@ -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"