Merge pull request #7 from gdevillele/pr-fix-service-ls-filter

remove service runtime filter from client
This commit is contained in:
Gaetan 2017-04-28 10:48:25 -07:00 committed by GitHub
commit f5c8a61c9b
2 changed files with 1 additions and 7 deletions

View File

@ -45,9 +45,7 @@ func runList(dockerCli *command.DockerCli, opts listOptions) error {
ctx := context.Background() ctx := context.Background()
client := dockerCli.Client() client := dockerCli.Client()
serviceFilters := opts.filter.Value() services, err := client.ServiceList(ctx, types.ServiceListOptions{})
serviceFilters.Add("runtime", string(swarm.RuntimeContainer))
services, err := client.ServiceList(ctx, types.ServiceListOptions{Filters: serviceFilters})
if err != nil { if err != nil {
return err return err
} }

View File

@ -13,7 +13,6 @@ import (
"github.com/docker/cli/cli/command/task" "github.com/docker/cli/cli/command/task"
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/filters"
swarmtypes "github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/opts" "github.com/docker/docker/opts"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -59,11 +58,8 @@ func runPS(dockerCli *command.DockerCli, opts psOptions) error {
serviceIDFilter := filters.NewArgs() serviceIDFilter := filters.NewArgs()
serviceNameFilter := filters.NewArgs() serviceNameFilter := filters.NewArgs()
for _, service := range opts.services { for _, service := range opts.services {
// default to container runtime
serviceIDFilter.Add("id", service) serviceIDFilter.Add("id", service)
serviceIDFilter.Add("runtime", string(swarmtypes.RuntimeContainer))
serviceNameFilter.Add("name", service) serviceNameFilter.Add("name", service)
serviceNameFilter.Add("runtime", string(swarmtypes.RuntimeContainer))
} }
serviceByIDList, err := client.ServiceList(ctx, types.ServiceListOptions{Filters: serviceIDFilter}) serviceByIDList, err := client.ServiceList(ctx, types.ServiceListOptions{Filters: serviceIDFilter})
if err != nil { if err != nil {