Merge pull request #32813 from ehazlett/fix-service-ls-filter
Move service runtime filter to server
This commit is contained in:
commit
f3ff8dc584
3 changed files with 4 additions and 6 deletions
|
@ -46,7 +46,6 @@ func runList(dockerCli *command.DockerCli, opts listOptions) error {
|
||||||
client := dockerCli.Client()
|
client := dockerCli.Client()
|
||||||
|
|
||||||
serviceFilters := opts.filter.Value()
|
serviceFilters := opts.filter.Value()
|
||||||
serviceFilters.Add("runtime", string(swarm.RuntimeContainer))
|
|
||||||
services, err := client.ServiceList(ctx, types.ServiceListOptions{Filters: serviceFilters})
|
services, err := client.ServiceList(ctx, types.ServiceListOptions{Filters: serviceFilters})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -7,7 +7,6 @@ import (
|
||||||
|
|
||||||
"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/cli"
|
"github.com/docker/docker/cli"
|
||||||
"github.com/docker/docker/cli/command"
|
"github.com/docker/docker/cli/command"
|
||||||
"github.com/docker/docker/cli/command/formatter"
|
"github.com/docker/docker/cli/command/formatter"
|
||||||
|
@ -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 {
|
||||||
|
|
|
@ -54,7 +54,10 @@ func (c *Cluster) GetServices(options apitypes.ServiceListOptions) ([]types.Serv
|
||||||
NamePrefixes: options.Filters.Get("name"),
|
NamePrefixes: options.Filters.Get("name"),
|
||||||
IDPrefixes: options.Filters.Get("id"),
|
IDPrefixes: options.Filters.Get("id"),
|
||||||
Labels: runconfigopts.ConvertKVStringsToMap(options.Filters.Get("label")),
|
Labels: runconfigopts.ConvertKVStringsToMap(options.Filters.Get("label")),
|
||||||
Runtimes: options.Filters.Get("runtime"),
|
// (ehazlett): hardcode runtime for now. eventually we will
|
||||||
|
// be able to filter for the desired runtimes once more
|
||||||
|
// are supported.
|
||||||
|
Runtimes: []string{string(types.RuntimeContainer)},
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, cancel := c.getRequestContext()
|
ctx, cancel := c.getRequestContext()
|
||||||
|
|
Loading…
Reference in a new issue