Skip to content

Commit 3d0b57a

Browse files
authored
[CWS] fix sqlite rpmdb loading in trivy-less collectorv2 (#41822)
### What does this PR do? This PR makes sure the sqlite driver is loaded correctly, which is a requirement for the rpm SBOM collector to work as expected, when trivy is not loaded in the system-probe. Fixes: #40934 ### Motivation ### Describe how you validated your changes ### Additional Notes
1 parent eaed0cd commit 3d0b57a

File tree

1 file changed

+21
-0
lines changed
  • pkg/security/resolvers/sbom/collectorv2

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed
2+
// under the Apache License Version 2.0.
3+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
4+
// Copyright 2016-present Datadog, Inc.
5+
6+
// Package collectorv2 holds sbom related files
7+
package collectorv2
8+
9+
import (
10+
// used to read RPM database
11+
"database/sql"
12+
13+
"github.com/mattn/go-sqlite3"
14+
)
15+
16+
// This is required to load sqlite based RPM databases
17+
func init() {
18+
// mattn/go-sqlite3 is only registering the sqlite3 driver
19+
// let's register the sqlite (no 3) driver as well
20+
sql.Register("sqlite", &sqlite3.SQLiteDriver{})
21+
}

0 commit comments

Comments
 (0)