From 86e4ef1459fb5c9c266c21e2ae791f4506ec8b24 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Tue, 23 Apr 2024 20:49:14 -0400 Subject: [PATCH] Ignore failure to ignore thinpool keys Fixes: https://github.com/containers/podman/issues/22473 Signed-off-by: Daniel J Walsh --- types/options.go | 9 +++++++-- types/options_test.go | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/types/options.go b/types/options.go index 03e5f7ab64..847cf5f1f4 100644 --- a/types/options.go +++ b/types/options.go @@ -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) { diff --git a/types/options_test.go b/types/options_test.go index 26facc7a86..c647e7e87b 100644 --- a/types/options_test.go +++ b/types/options_test.go @@ -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) }