diff --git a/daemon/config/config.go b/daemon/config/config.go index f4b3cc8f19..80ecbbd955 100644 --- a/daemon/config/config.go +++ b/daemon/config/config.go @@ -63,6 +63,8 @@ var flatOptions = map[string]bool{ var skipValidateOptions = map[string]bool{ "features": true, "builder": true, + // Corresponding flag has been removed because it was already unusable + "deprecated-key-path": true, } // skipDuplicates contains configuration keys that diff --git a/integration/config/config_test.go b/integration/config/config_test.go index 5cadf09dac..ec5b060cd2 100644 --- a/integration/config/config_test.go +++ b/integration/config/config_test.go @@ -4,6 +4,8 @@ import ( "bytes" "context" "encoding/json" + "io/ioutil" + "path/filepath" "sort" "testing" "time" @@ -13,6 +15,7 @@ import ( swarmtypes "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/client" "github.com/docker/docker/integration/internal/swarm" + "github.com/docker/docker/internal/test/daemon" "github.com/docker/docker/pkg/stdcopy" "gotest.tools/assert" is "gotest.tools/assert/cmp" @@ -417,6 +420,26 @@ func TestConfigCreateResolve(t *testing.T) { assert.Assert(t, is.Equal(0, len(entries))) } +func TestConfigDaemonLibtrustID(t *testing.T) { + skip.If(t, testEnv.DaemonInfo.OSType != "linux") + defer setupTest(t)() + + d := daemon.New(t) + defer d.Stop(t) + + trustKey := filepath.Join(d.RootDir(), "key.json") + err := ioutil.WriteFile(trustKey, []byte(`{"crv":"P-256","d":"dm28PH4Z4EbyUN8L0bPonAciAQa1QJmmyYd876mnypY","kid":"WTJ3:YSIP:CE2E:G6KJ:PSBD:YX2Y:WEYD:M64G:NU2V:XPZV:H2CR:VLUB","kty":"EC","x":"Mh5-JINSjaa_EZdXDttri255Z5fbCEOTQIZjAcScFTk","y":"eUyuAjfxevb07hCCpvi4Zi334Dy4GDWQvEToGEX4exQ"}`), 0644) + assert.NilError(t, err) + + config := filepath.Join(d.RootDir(), "daemon.json") + err = ioutil.WriteFile(config, []byte(`{"deprecated-key-path": "`+trustKey+`"}`), 0644) + assert.NilError(t, err) + + d.Start(t, "--config-file", config) + info := d.Info(t) + assert.Equal(t, info.ID, "WTJ3:YSIP:CE2E:G6KJ:PSBD:YX2Y:WEYD:M64G:NU2V:XPZV:H2CR:VLUB") +} + func configNamesFromList(entries []swarmtypes.Config) []string { var values []string for _, entry := range entries {