File tree Expand file tree Collapse file tree 2 files changed +68
-0
lines changed Expand file tree Collapse file tree 2 files changed +68
-0
lines changed Original file line number Diff line number Diff line change @@ -167,6 +167,28 @@ func TestDiscoverDistro(t *testing.T) {
167
167
distroExpected : & bottlerocket {},
168
168
errExpected : false ,
169
169
},
170
+ {
171
+ // os-release ID "ol" maps to oracle
172
+ krInput : "5.10.0-2047.510.5.5.el7uek.x86_64" ,
173
+ preFn : func () error {
174
+ type brCfg struct {
175
+ OsID string `ini:"ID"`
176
+ }
177
+ f := ini .Empty ()
178
+ err := f .ReflectFrom (& brCfg {
179
+ OsID : "ol" ,
180
+ })
181
+ if err != nil {
182
+ return err
183
+ }
184
+ return f .SaveTo (osReleaseFile )
185
+ },
186
+ postFn : func () {
187
+ _ = os .Remove (osReleaseFile )
188
+ },
189
+ distroExpected : & ol {},
190
+ errExpected : false ,
191
+ },
170
192
{
171
193
// No os-release but "centos-release" file present maps to centos
172
194
krInput : "5.10.0" ,
Original file line number Diff line number Diff line change
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // Copyright (C) 2024 The Falco Authors
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+
16
+ package driverdistro
17
+
18
+ import (
19
+ "strings"
20
+
21
+ "github.com/falcosecurity/driverkit/pkg/kernelrelease"
22
+
23
+ drivertype "github.com/falcosecurity/falcoctl/pkg/driver/type"
24
+ )
25
+
26
+ func init () {
27
+ distros ["ol" ] = & ol {generic : & generic {}}
28
+ }
29
+
30
+ type ol struct {
31
+ * generic
32
+ }
33
+
34
+ //nolint:gocritic // the method shall not be able to modify kr
35
+ func (o * ol ) PreferredDriver (kr kernelrelease.KernelRelease , allowedDriverTypes []drivertype.DriverType ) drivertype.DriverType {
36
+ for _ , allowedDrvType := range allowedDriverTypes {
37
+ // Skip dkms on UEK hosts because it will always fail
38
+ if allowedDrvType .String () == drivertype .TypeKmod && strings .Contains (kr .String (), "uek" ) {
39
+ continue
40
+ }
41
+ if allowedDrvType .Supported (kr ) {
42
+ return allowedDrvType
43
+ }
44
+ }
45
+ return nil
46
+ }
You can’t perform that action at this time.
0 commit comments