Skip to content

Commit 7ee2a4d

Browse files
committed
Add rocky linux support to GetOSVersion
1 parent f39c93e commit 7ee2a4d

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

Diff for: pkg/util/helpers_linux.go

+2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ func getOSVersion(osReleasePath string) (string, error) {
5656
return getDebianVersion(osReleaseMap), nil
5757
case "centos":
5858
return getDebianVersion(osReleaseMap), nil
59+
case "rocky":
60+
return getDebianVersion(osReleaseMap), nil
5961
case "rhel":
6062
return getDebianVersion(osReleaseMap), nil
6163
case "ol":

Diff for: pkg/util/helpers_linux_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ func TestGetOSVersionLinux(t *testing.T) {
5151
expectedOSVersion: "centos 7 (Core)",
5252
expectErr: false,
5353
},
54+
{
55+
name: "rocky",
56+
fakeOSReleasePath: "testdata/os-release-rocky",
57+
expectedOSVersion: "rocky 8.5 (Green Obsidian)",
58+
expectErr: false,
59+
},
5460
{
5561
name: "rhel",
5662
fakeOSReleasePath: "testdata/os-release-rhel",

Diff for: pkg/util/testdata/os-release-rocky

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
NAME="Rocky Linux"
2+
VERSION="8.5 (Green Obsidian)"
3+
ID="rocky"
4+
ID_LIKE="rhel centos fedora"
5+
VERSION_ID="8.5"
6+
PLATFORM_ID="platform:el8"
7+
PRETTY_NAME="Rocky Linux 8.5 (Green Obsidian)"
8+
ANSI_COLOR="0;32"
9+
CPE_NAME="cpe:/o:rocky:rocky:8.5:GA"
10+
HOME_URL="https://rockylinux.org/"
11+
BUG_REPORT_URL="https://bugs.rockylinux.org/"
12+
ROCKY_SUPPORT_PRODUCT="Rocky Linux"
13+
ROCKY_SUPPORT_PRODUCT_VERSION="8"

0 commit comments

Comments
 (0)