mirror of
https://github.com/containers/podman.git
synced 2025-11-29 01:28:22 +08:00
Merge pull request #27294 from mheon/warn_on_boltdb
Warn on BoltDB usage
This commit is contained in:
@@ -81,6 +81,7 @@ function _run_sys() {
|
||||
}
|
||||
|
||||
function _run_upgrade_test() {
|
||||
export SUPPRESS_BOLTDB_WARNING=true
|
||||
showrun bats test/upgrade |& logformatter
|
||||
}
|
||||
|
||||
|
||||
@@ -81,12 +81,14 @@ func NewBoltState(path string, runtime *Runtime) (State, error) {
|
||||
|
||||
logrus.Debugf("Initializing boltdb state at %s", path)
|
||||
|
||||
ciDesiredDB := os.Getenv("CI_DESIRED_DATABASE")
|
||||
|
||||
// BoltDB is deprecated and, as of Podman 5.0, we no longer allow the
|
||||
// creation of new Bolt states.
|
||||
// If the DB does not already exist, error out.
|
||||
// To continue testing in CI, allow creation iff an undocumented env
|
||||
// var is set.
|
||||
if os.Getenv("CI_DESIRED_DATABASE") != "boltdb" {
|
||||
if ciDesiredDB != "boltdb" {
|
||||
if err := fileutils.Exists(path); err != nil && errors.Is(err, fs.ErrNotExist) {
|
||||
return nil, fmt.Errorf("the BoltDB backend has been deprecated, no new BoltDB databases can be created: %w", define.ErrInvalidArg)
|
||||
}
|
||||
@@ -94,9 +96,9 @@ func NewBoltState(path string, runtime *Runtime) (State, error) {
|
||||
logrus.Debugf("Allowing deprecated database backend due to CI_DESIRED_DATABASE.")
|
||||
}
|
||||
|
||||
// TODO: Up this to WARN level in 5.7, ERROR level in 5.8
|
||||
if os.Getenv("SUPPRESS_BOLTDB_WARNING") == "" {
|
||||
logrus.Infof("The deprecated BoltDB database driver is in use. This driver will be removed in the upcoming Podman 6.0 release in mid 2026. It is advised that you migrate to SQLite to avoid issues when this occurs. Set SUPPRESS_BOLTDB_WARNING environment variable to remove this message.")
|
||||
// TODO: Up this to ERROR level in 5.8
|
||||
if os.Getenv("SUPPRESS_BOLTDB_WARNING") == "" && ciDesiredDB != "boltdb" {
|
||||
logrus.Warnf("The deprecated BoltDB database driver is in use. This driver will be removed in the upcoming Podman 6.0 release in mid 2026. It is advised that you migrate to SQLite to avoid issues when this occurs. Set SUPPRESS_BOLTDB_WARNING environment variable to remove this message.")
|
||||
}
|
||||
|
||||
db, err := bolt.Open(path, 0o600, nil)
|
||||
|
||||
@@ -289,6 +289,7 @@ EOF
|
||||
|
||||
}
|
||||
|
||||
# TODO 6.0: Remove this
|
||||
@test "podman - BoltDB cannot create new databases" {
|
||||
skip_if_remote "DB checks only work for local Podman"
|
||||
|
||||
@@ -302,7 +303,7 @@ EOF
|
||||
assert "$output" =~ "Allowing deprecated database backend" \
|
||||
"with CI_DESIRED_DATABASE"
|
||||
|
||||
run_podman $safe_opts system reset --force
|
||||
SUPPRESS_BOLTDB_WARNING=true run_podman $safe_opts system reset --force
|
||||
}
|
||||
|
||||
@test "podman - empty string defaults for certain values" {
|
||||
|
||||
@@ -207,6 +207,8 @@ function wait_for_journal() {
|
||||
# Ref https://github.com/containers/podman/pull/21563#issuecomment-1965145324
|
||||
local quadlet_file=$PODMAN_TMPDIR/basic_$(safename).container
|
||||
cat > $quadlet_file <<EOF
|
||||
[Service]
|
||||
Environment=SUPPRESS_BOLTDB_WARNING=true
|
||||
[Container]
|
||||
Image=$IMAGE
|
||||
# Note it is important that the trap is before the ready message,
|
||||
|
||||
Reference in New Issue
Block a user