Skip to content

Commit

Permalink
Add Oracle Linux to the RedHat OS family
Browse files Browse the repository at this point in the history
Added the Oracle Linux ("ol") platform to "redhat" OS family.

Fixes #54
  • Loading branch information
andrewkroh committed Jun 1, 2022
1 parent f2015f1 commit 2454e01
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Added the Oracle Linux ("ol") platform to "redhat" OS family. [#54](https://github.com/elastic/go-sysinfo/issues/54) [#115](https://github.com/elastic/go-sysinfo/pull/115)
- Updated module to require Go 1.17. [#111](https://github.com/elastic/go-sysinfo/pull/111)

### Deprecated
Expand Down
2 changes: 1 addition & 1 deletion providers/linux/os.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var (

// familyMap contains a mapping of family -> []platforms.
var familyMap = map[string][]string{
"redhat": {"redhat", "fedora", "centos", "scientific", "oraclelinux", "amzn", "rhel"},
"redhat": {"redhat", "fedora", "centos", "scientific", "oraclelinux", "ol", "amzn", "rhel"},
"debian": {"debian", "ubuntu", "raspbian"},
"suse": {"suse", "sles", "opensuse"},
}
Expand Down
16 changes: 16 additions & 0 deletions providers/linux/os_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,22 @@ func TestOperatingSystem(t *testing.T) {
}, *os)
t.Logf("%#v", os)
})
t.Run("oraclelinux7", func(t *testing.T) {
os, err := getOSInfo("testdata/oraclelinux7")
if err != nil {
t.Fatal(err)
}
assert.Equal(t, types.OSInfo{
Type: "linux",
Family: "redhat",
Platform: "ol",
Name: "Oracle Linux Server",
Version: "7.9",
Major: 7,
Minor: 9,
}, *os)
t.Logf("%#v", os)
})
t.Run("ubuntu1404", func(t *testing.T) {
os, err := getOSInfo("testdata/ubuntu1404")
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions providers/linux/testdata/oraclelinux7/etc/oracle-release
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Oracle Linux Server release 7.9
17 changes: 17 additions & 0 deletions providers/linux/testdata/oraclelinux7/etc/os-release
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
NAME="Oracle Linux Server"
VERSION="7.9"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="7.9"
PRETTY_NAME="Oracle Linux Server 7.9"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:7:9:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://bugzilla.oracle.com/"

ORACLE_BUGZILLA_PRODUCT="Oracle Linux 7"
ORACLE_BUGZILLA_PRODUCT_VERSION=7.9
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=7.9
1 change: 1 addition & 0 deletions providers/linux/testdata/oraclelinux7/etc/redhat-release
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Red Hat Enterprise Linux Server release 7.9 (Maipo)
1 change: 1 addition & 0 deletions providers/linux/testdata/oraclelinux7/etc/system-release

0 comments on commit 2454e01

Please sign in to comment.