Skip to content

Commit

Permalink
Ignore failure to ignore thinpool keys
Browse files Browse the repository at this point in the history
Fixes: containers/podman#22473

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
  • Loading branch information
rhatdan committed Apr 24, 2024
1 parent 3cbd3c6 commit 8d6d30e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 7 additions & 2 deletions types/options.go
Expand Up @@ -418,8 +418,13 @@ func ReloadConfigurationFile(configFile string, storeOptions *StoreOptions) erro
meta, err := toml.DecodeFile(configFile, &config)
if err == nil {
keys := meta.Undecoded()
if len(keys) > 0 {
logrus.Warningf("Failed to decode the keys %q from %q", keys, configFile)
for _, key := range keys {
// Since thinpool was removed older storage.conf files
// will generate bogus warnings
if key.String() == "storage.options.thinpool" {
continue
}
logrus.Warningf("Failed to decode the key %q from %q", key, configFile)
}
} else {
if !os.IsNotExist(err) {
Expand Down
3 changes: 1 addition & 2 deletions types/options_test.go
Expand Up @@ -6,7 +6,6 @@ import (
"os"
"path/filepath"
"reflect"
"strings"
"testing"

"github.com/containers/storage/pkg/idtools"
Expand Down Expand Up @@ -204,5 +203,5 @@ func TestReloadConfigurationFile(t *testing.T) {
assert.Equal(t, storageOpts.RunRoot, "/run/containers/test")
logrus.SetOutput(os.Stderr)

assert.Equal(t, strings.Contains(content.String(), "Failed to decode the keys [\\\"foo\\\" \\\"storage.options.graphroot\\\"] from \\\"./storage_broken.conf\\\"\""), true)
assert.Equal(t, content.String(), `Failed to decode the key "foo" from "./storage_broken.conf"`)
}

0 comments on commit 8d6d30e

Please sign in to comment.