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 <[email protected]>
  • Loading branch information
rhatdan committed Apr 25, 2024
1 parent 3cbd3c6 commit 5936470
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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)
require.Contains(t, content.String(), `Failed to decode the key "foo" from "./storage_broken.conf"`)
}

0 comments on commit 5936470

Please sign in to comment.