Merge pull request #27948 from WeiZhang555/consistent-filters

Replace all "Filter" field with "Filters" for consistency
This commit is contained in:
Sebastiaan van Stijn 2016-11-02 00:53:15 -07:00 committed by GitHub
commit 81e6e5e36d
10 changed files with 16 additions and 16 deletions

View File

@ -79,10 +79,10 @@ func (p *preProcessor) Networks() bool {
func buildContainerListOptions(opts *psOptions) (*types.ContainerListOptions, error) { func buildContainerListOptions(opts *psOptions) (*types.ContainerListOptions, error) {
options := &types.ContainerListOptions{ options := &types.ContainerListOptions{
All: opts.all, All: opts.all,
Limit: opts.last, Limit: opts.last,
Size: opts.size, Size: opts.size,
Filter: opts.filter.Value(), Filters: opts.filter.Value(),
} }
if opts.nLatest && opts.last == -1 { if opts.nLatest && opts.last == -1 {

View File

@ -55,10 +55,10 @@ func TestBuildContainerListOptions(t *testing.T) {
assert.Equal(t, c.expectedAll, options.All) assert.Equal(t, c.expectedAll, options.All)
assert.Equal(t, c.expectedSize, options.Size) assert.Equal(t, c.expectedSize, options.Size)
assert.Equal(t, c.expectedLimit, options.Limit) assert.Equal(t, c.expectedLimit, options.Limit)
assert.Equal(t, options.Filter.Len(), len(c.expectedFilters)) assert.Equal(t, options.Filters.Len(), len(c.expectedFilters))
for k, v := range c.expectedFilters { for k, v := range c.expectedFilters {
f := options.Filter f := options.Filters
if !f.ExactMatch(k, v) { if !f.ExactMatch(k, v) {
t.Fatalf("Expected filter with key %s to be %s but got %s", k, v, f.Get(k)) t.Fatalf("Expected filter with key %s to be %s but got %s", k, v, f.Get(k))
} }

View File

@ -50,7 +50,7 @@ func runList(dockerCli *command.DockerCli, opts listOptions) error {
nodes, err := client.NodeList( nodes, err := client.NodeList(
ctx, ctx,
types.NodeListOptions{Filter: opts.filter.Value()}) types.NodeListOptions{Filters: opts.filter.Value()})
if err != nil { if err != nil {
return err return err
} }

View File

@ -72,7 +72,7 @@ func runPs(dockerCli *command.DockerCli, opts psOptions) error {
filter := opts.filter.Value() filter := opts.filter.Value()
filter.Add("node", node.ID) filter.Add("node", node.ID)
nodeTasks, err := client.TaskList(ctx, types.TaskListOptions{Filter: filter}) nodeTasks, err := client.TaskList(ctx, types.TaskListOptions{Filters: filter})
if err != nil { if err != nil {
errs = append(errs, err.Error()) errs = append(errs, err.Error())
continue continue

View File

@ -51,7 +51,7 @@ func runList(dockerCli *command.DockerCli, opts listOptions) error {
client := dockerCli.Client() client := dockerCli.Client()
out := dockerCli.Out() out := dockerCli.Out()
services, err := client.ServiceList(ctx, types.ServiceListOptions{Filter: opts.filter.Value()}) services, err := client.ServiceList(ctx, types.ServiceListOptions{Filters: opts.filter.Value()})
if err != nil { if err != nil {
return err return err
} }
@ -63,7 +63,7 @@ func runList(dockerCli *command.DockerCli, opts listOptions) error {
taskFilter.Add("service", service.ID) taskFilter.Add("service", service.ID)
} }
tasks, err := client.TaskList(ctx, types.TaskListOptions{Filter: taskFilter}) tasks, err := client.TaskList(ctx, types.TaskListOptions{Filters: taskFilter})
if err != nil { if err != nil {
return err return err
} }

View File

@ -64,7 +64,7 @@ func runPS(dockerCli *command.DockerCli, opts psOptions) error {
} }
} }
tasks, err := client.TaskList(ctx, types.TaskListOptions{Filter: filter}) tasks, err := client.TaskList(ctx, types.TaskListOptions{Filters: filter})
if err != nil { if err != nil {
return err return err
} }

View File

@ -34,7 +34,7 @@ func getServices(
) ([]swarm.Service, error) { ) ([]swarm.Service, error) {
return apiclient.ServiceList( return apiclient.ServiceList(
ctx, ctx,
types.ServiceListOptions{Filter: getStackFilter(namespace)}) types.ServiceListOptions{Filters: getStackFilter(namespace)})
} }
func getNetworks( func getNetworks(

View File

@ -87,7 +87,7 @@ func getStacks(
services, err := apiclient.ServiceList( services, err := apiclient.ServiceList(
ctx, ctx,
types.ServiceListOptions{Filter: filter}) types.ServiceListOptions{Filters: filter})
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -56,7 +56,7 @@ func runPS(dockerCli *command.DockerCli, opts psOptions) error {
filter.Add("desired-state", string(swarm.TaskStateAccepted)) filter.Add("desired-state", string(swarm.TaskStateAccepted))
} }
tasks, err := client.TaskList(ctx, types.TaskListOptions{Filter: filter}) tasks, err := client.TaskList(ctx, types.TaskListOptions{Filters: filter})
if err != nil { if err != nil {
return err return err
} }

View File

@ -46,7 +46,7 @@ func runServices(dockerCli *command.DockerCli, opts servicesOptions) error {
filter := opts.filter.Value() filter := opts.filter.Value()
filter.Add("label", labelNamespace+"="+opts.namespace) filter.Add("label", labelNamespace+"="+opts.namespace)
services, err := client.ServiceList(ctx, types.ServiceListOptions{Filter: filter}) services, err := client.ServiceList(ctx, types.ServiceListOptions{Filters: filter})
if err != nil { if err != nil {
return err return err
} }
@ -67,7 +67,7 @@ func runServices(dockerCli *command.DockerCli, opts servicesOptions) error {
taskFilter.Add("service", service.ID) taskFilter.Add("service", service.ID)
} }
tasks, err := client.TaskList(ctx, types.TaskListOptions{Filter: taskFilter}) tasks, err := client.TaskList(ctx, types.TaskListOptions{Filters: taskFilter})
if err != nil { if err != nil {
return err return err
} }