ソースを参照

Merge pull request #32813 from ehazlett/fix-service-ls-filter

Move service runtime filter to server
Victor Vieux 8 年 前
コミット
f3ff8dc584
3 ファイル変更4 行追加6 行削除
  1. 0 1
      cli/command/service/list.go
  2. 0 4
      cli/command/service/ps.go
  3. 4 1
      daemon/cluster/services.go

+ 0 - 1
cli/command/service/list.go

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

+ 0 - 4
cli/command/service/ps.go

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

+ 4 - 1
daemon/cluster/services.go

@@ -54,7 +54,10 @@ func (c *Cluster) GetServices(options apitypes.ServiceListOptions) ([]types.Serv
 		NamePrefixes: options.Filters.Get("name"),
 		IDPrefixes:   options.Filters.Get("id"),
 		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()