Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pkg/util/helpers_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ func getOSVersion(osReleasePath string) (string, error) {
return getDebianVersion(osReleaseMap), nil
case "rhel":
return getDebianVersion(osReleaseMap), nil
case "ol":
return getDebianVersion(osReleaseMap), nil
case "amzn":
return getDebianVersion(osReleaseMap), nil
case "sles":
return getDebianVersion(osReleaseMap), nil
default:
return "", fmt.Errorf("Unsupported ID in /etc/os-release: %q", osReleaseMap["ID"])
}
Expand Down
18 changes: 18 additions & 0 deletions pkg/util/helpers_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,24 @@ func TestGetOSVersionLinux(t *testing.T) {
expectedOSVersion: "rhel 7.7 (Maipo)",
expectErr: false,
},
{
name: "ol",
fakeOSReleasePath: "testdata/os-release-ol",
expectedOSVersion: "ol 9.0",
expectErr: false,
},
{
name: "amzn",
fakeOSReleasePath: "testdata/os-release-amzn",
expectedOSVersion: "amzn 2",
expectErr: false,
},
{
name: "sles",
fakeOSReleasePath: "testdata/os-release-sles",
expectedOSVersion: "sles 15-SP4",
expectErr: false,
},
{
name: "Unknown",
fakeOSReleasePath: "testdata/os-release-unknown",
Expand Down
9 changes: 9 additions & 0 deletions pkg/util/testdata/os-release-amzn
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"
18 changes: 18 additions & 0 deletions pkg/util/testdata/os-release-ol
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
NAME="Oracle Linux Server"
VERSION="9.0"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="9.0"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Oracle Linux Server 9.0"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:9:0:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://github.com/oracle/oracle-linux"

ORACLE_BUGZILLA_PRODUCT="Oracle Linux 9"
ORACLE_BUGZILLA_PRODUCT_VERSION=9.0
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=9.0
9 changes: 9 additions & 0 deletions pkg/util/testdata/os-release-sles
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
NAME="SLES"
VERSION="15-SP4"
VERSION_ID="15.4"
PRETTY_NAME="SUSE Linux Enterprise Server 15 SP4"
ID="sles"
ID_LIKE="suse"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:15:sp4"
DOCUMENTATION_URL="https://documentation.suse.com/"