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 408479e commit 86e4ef1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 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
2 changes: 1 addition & 1 deletion types/options_test.go
Expand Up @@ -204,5 +204,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, strings.Contains(content.String(), "Failed to decode the key \\\"foo\\\" from \\\"./storage_broken.conf\\\"\""), true)
}

0 comments on commit 86e4ef1

Please sign in to comment.