Repository: elastic/go-sysinfo (go)

Issue:
Add ol to redhat  os family for Oracle Linux Server
Example of Oracle Linux Server /etc/os-release file:
NAME="Oracle Linux Server"
VERSION="7.4"
ID="ol"
VERSION_ID="7.4"

ID parameter contains "ol" word

Pull request:
Add Oracle Linux to the RedHat OS family
Added the Oracle Linux ("ol") platform to "redhat" OS family. And added testdata from Oracle Linux 7 to check OS metadata collection. The data was captured from `docker pull oraclelinux:7.9`.

Fixes #54

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5776a2e..902c4ef 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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)
 - The boot time value for Windows is now rounded to the nearest second to provide a more stable value. [#53](https://github.com/elastic/go-sysinfo/issues/53) [#114](https://github.com/elastic/go-sysinfo/pull/114)
 
diff --git a/providers/linux/os.go b/providers/linux/os.go
index cb172c0..19ff00c 100644
--- a/providers/linux/os.go
+++ b/providers/linux/os.go
@@ -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"},
 }


Test patch:
diff --git a/providers/linux/os_test.go b/providers/linux/os_test.go
index 7cebe70..422ab02 100644
--- a/providers/linux/os_test.go
+++ b/providers/linux/os_test.go
@@ -166,6 +166,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 {
diff --git a/providers/linux/testdata/oraclelinux7/etc/oracle-release b/providers/linux/testdata/oraclelinux7/etc/oracle-release
new file mode 100644
index 0000000..1c41687
--- /dev/null
+++ b/providers/linux/testdata/oraclelinux7/etc/oracle-release
@@ -0,0 +1,1 @@
+Oracle Linux Server release 7.9
diff --git a/providers/linux/testdata/oraclelinux7/etc/os-release b/providers/linux/testdata/oraclelinux7/etc/os-release
new file mode 100644
index 0000000..f8823a8
--- /dev/null
+++ b/providers/linux/testdata/oraclelinux7/etc/os-release
@@ -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
diff --git a/providers/linux/testdata/oraclelinux7/etc/redhat-release b/providers/linux/testdata/oraclelinux7/etc/redhat-release
new file mode 100644
index 0000000..db5baab
--- /dev/null
+++ b/providers/linux/testdata/oraclelinux7/etc/redhat-release
@@ -0,0 +1,1 @@
+Red Hat Enterprise Linux Server release 7.9 (Maipo)
diff --git a/providers/linux/testdata/oraclelinux7/etc/system-release b/providers/linux/testdata/oraclelinux7/etc/system-release
new file mode 120000
index 0000000..b5cb9bd
--- /dev/null
+++ b/providers/linux/testdata/oraclelinux7/etc/system-release
@@ -0,0 +1,1 @@
+oracle-release
\ No newline at end of file