diff --git a/command/secret/inspect.go b/command/secret/inspect.go index c5b0aa6a3d..25da79f16d 100644 --- a/command/secret/inspect.go +++ b/command/secret/inspect.go @@ -35,7 +35,7 @@ func runSecretInspect(dockerCli *command.DockerCli, opts inspectOptions) error { ctx := context.Background() // attempt to lookup secret by name - secrets, err := getSecrets(client, ctx, []string{opts.name}) + secrets, err := getSecretsByName(client, ctx, []string{opts.name}) if err != nil { return err } diff --git a/command/secret/remove.go b/command/secret/remove.go index 9396b9b179..d277eceba2 100644 --- a/command/secret/remove.go +++ b/command/secret/remove.go @@ -32,7 +32,7 @@ func runSecretRemove(dockerCli *command.DockerCli, opts removeOptions) error { ctx := context.Background() // attempt to lookup secret by name - secrets, err := getSecrets(client, ctx, opts.ids) + secrets, err := getSecretsByName(client, ctx, opts.ids) if err != nil { return err } diff --git a/command/secret/utils.go b/command/secret/utils.go index 40aa4a6d77..d1a7d97c44 100644 --- a/command/secret/utils.go +++ b/command/secret/utils.go @@ -9,13 +9,13 @@ import ( "github.com/docker/docker/client" ) -func getSecrets(client client.APIClient, ctx context.Context, names []string) ([]swarm.Secret, error) { +func getSecretsByName(client client.APIClient, ctx context.Context, names []string) ([]swarm.Secret, error) { args := filters.NewArgs() for _, n := range names { args.Add("names", n) } return client.SecretList(ctx, types.SecretListOptions{ - Filter: args, + Filters: args, }) } diff --git a/command/service/opts_test.go b/command/service/opts_test.go index 551dfc239c..3df3a4fd5d 100644 --- a/command/service/opts_test.go +++ b/command/service/opts_test.go @@ -108,45 +108,45 @@ func TestHealthCheckOptionsToHealthConfigConflict(t *testing.T) { } func TestSecretOptionsSimple(t *testing.T) { - var opt SecretOpt + var opt opts.SecretOpt - testCase := "source=/foo,target=testing" + testCase := "source=foo,target=testing" assert.NilError(t, opt.Set(testCase)) reqs := opt.Value() assert.Equal(t, len(reqs), 1) req := reqs[0] - assert.Equal(t, req.source, "/foo") - assert.Equal(t, req.target, "testing") + assert.Equal(t, req.Source, "foo") + assert.Equal(t, req.Target, "testing") } func TestSecretOptionsCustomUidGid(t *testing.T) { - var opt SecretOpt + var opt opts.SecretOpt - testCase := "source=/foo,target=testing,uid=1000,gid=1001" + testCase := "source=foo,target=testing,uid=1000,gid=1001" assert.NilError(t, opt.Set(testCase)) reqs := opt.Value() assert.Equal(t, len(reqs), 1) req := reqs[0] - assert.Equal(t, req.source, "/foo") - assert.Equal(t, req.target, "testing") - assert.Equal(t, req.uid, "1000") - assert.Equal(t, req.gid, "1001") + assert.Equal(t, req.Source, "foo") + assert.Equal(t, req.Target, "testing") + assert.Equal(t, req.UID, "1000") + assert.Equal(t, req.GID, "1001") } func TestSecretOptionsCustomMode(t *testing.T) { - var opt SecretOpt + var opt opts.SecretOpt - testCase := "source=/foo,target=testing,uid=1000,gid=1001,mode=0444" + testCase := "source=foo,target=testing,uid=1000,gid=1001,mode=0444" assert.NilError(t, opt.Set(testCase)) reqs := opt.Value() assert.Equal(t, len(reqs), 1) req := reqs[0] - assert.Equal(t, req.source, "/foo") - assert.Equal(t, req.target, "testing") - assert.Equal(t, req.uid, "1000") - assert.Equal(t, req.gid, "1001") - assert.Equal(t, req.mode, os.FileMode(0444)) + assert.Equal(t, req.Source, "foo") + assert.Equal(t, req.Target, "testing") + assert.Equal(t, req.UID, "1000") + assert.Equal(t, req.GID, "1001") + assert.Equal(t, req.Mode, os.FileMode(0444)) } diff --git a/command/service/parse.go b/command/service/parse.go index cbf2745dce..4728c773c4 100644 --- a/command/service/parse.go +++ b/command/service/parse.go @@ -1,13 +1,13 @@ package service import ( - "context" "fmt" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" swarmtypes "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/client" + "golang.org/x/net/context" ) // parseSecrets retrieves the secrets from the requested names and converts @@ -39,7 +39,7 @@ func parseSecrets(client client.APIClient, requestedSecrets []*types.SecretReque } secrets, err := client.SecretList(ctx, types.SecretListOptions{ - Filter: args, + Filters: args, }) if err != nil { return nil, err