Skip to content

Commit

Permalink
cli/command: remove unused args from ResolveDefaultContext()
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastiaan van Stijn <[email protected]>
  • Loading branch information
thaJeztah committed Mar 30, 2022
1 parent 68cad50 commit 7770910
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions cli/command/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func (cli *DockerCli) Initialize(opts *cliflags.ClientOptions, ops ...Initialize
cli.contextStore = &ContextStoreWithDefault{
Store: baseContextStore,
Resolver: func() (*DefaultContext, error) {
return ResolveDefaultContext(opts.Common, cli.ConfigFile(), cli.contextStoreConfig, cli.Err())
return ResolveDefaultContext(opts.Common, cli.contextStoreConfig)
},
}
cli.currentContext, err = resolveContextName(opts.Common, cli.configFile, cli.contextStore)
Expand Down Expand Up @@ -242,7 +242,7 @@ func NewAPIClientFromFlags(opts *cliflags.CommonOptions, configFile *configfile.
contextStore := &ContextStoreWithDefault{
Store: store.New(config.ContextStoreDir(), storeConfig),
Resolver: func() (*DefaultContext, error) {
return ResolveDefaultContext(opts, configFile, storeConfig, io.Discard)
return ResolveDefaultContext(opts, storeConfig)
},
}
contextName, err := resolveContextName(opts, configFile, contextStore)
Expand Down
6 changes: 2 additions & 4 deletions cli/command/defaultcontextstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ package command

import (
"fmt"
"io"

"github.com/docker/cli/cli/config/configfile"
"github.com/docker/cli/cli/context/docker"
"github.com/docker/cli/cli/context/store"
cliflags "github.com/docker/cli/cli/flags"
Expand Down Expand Up @@ -45,7 +43,7 @@ type EndpointDefaultResolver interface {
}

// ResolveDefaultContext creates a Metadata for the current CLI invocation parameters
func ResolveDefaultContext(opts *cliflags.CommonOptions, config *configfile.ConfigFile, storeconfig store.Config, stderr io.Writer) (*DefaultContext, error) {
func ResolveDefaultContext(opts *cliflags.CommonOptions, config store.Config) (*DefaultContext, error) {
contextTLSData := store.ContextTLSData{
Endpoints: make(map[string]store.EndpointTLSData),
}
Expand All @@ -66,7 +64,7 @@ func ResolveDefaultContext(opts *cliflags.CommonOptions, config *configfile.Conf
contextTLSData.Endpoints[docker.DockerEndpoint] = *dockerEP.TLSData.ToStoreTLSData()
}

if err := storeconfig.ForeachEndpointType(func(n string, get store.TypeGetter) error {
if err := config.ForeachEndpointType(func(n string, get store.TypeGetter) error {
if n == docker.DockerEndpoint { // handled above
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion cli/command/defaultcontextstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestDefaultContextInitializer(t *testing.T) {
TLSOptions: &tlsconfig.Options{
CAFile: "./testdata/ca.pem",
},
}, cli.ConfigFile(), DefaultContextStoreConfig(), cli.Err())
}, DefaultContextStoreConfig())
assert.NilError(t, err)
assert.Equal(t, "default", ctx.Meta.Name)
assert.DeepEqual(t, "ssh://someswarmserver", ctx.Meta.Endpoints[docker.DockerEndpoint].(docker.EndpointMeta).Host)
Expand Down

0 comments on commit 7770910

Please sign in to comment.