Browse code

updates for review comments

- runtimeUrl -> type_url
- runtimes -> runtime

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

Evan Hazlett authored on 2017/03/25 04:19:59
Showing 6 changed files
... ...
@@ -46,7 +46,7 @@ func runList(dockerCli *command.DockerCli, opts listOptions) error {
46 46
 	client := dockerCli.Client()
47 47
 
48 48
 	serviceFilters := opts.filter.Value()
49
-	serviceFilters.Add("runtimes", string(swarm.RuntimeContainer))
49
+	serviceFilters.Add("runtime", string(swarm.RuntimeContainer))
50 50
 	services, err := client.ServiceList(ctx, types.ServiceListOptions{Filters: serviceFilters})
51 51
 	if err != nil {
52 52
 		return err
... ...
@@ -61,9 +61,9 @@ func runPS(dockerCli *command.DockerCli, opts psOptions) error {
61 61
 	for _, service := range opts.services {
62 62
 		// default to container runtime
63 63
 		serviceIDFilter.Add("id", service)
64
-		serviceIDFilter.Add("runtimes", string(swarmtypes.RuntimeContainer))
64
+		serviceIDFilter.Add("runtime", string(swarmtypes.RuntimeContainer))
65 65
 		serviceNameFilter.Add("name", service)
66
-		serviceNameFilter.Add("runtimes", string(swarmtypes.RuntimeContainer))
66
+		serviceNameFilter.Add("runtime", string(swarmtypes.RuntimeContainer))
67 67
 	}
68 68
 	serviceByIDList, err := client.ServiceList(ctx, types.ServiceListOptions{Filters: serviceIDFilter})
69 69
 	if err != nil {
... ...
@@ -19,7 +19,7 @@ func getStackFilter(namespace string) filters.Args {
19 19
 
20 20
 func getServiceFilter(namespace string) filters.Args {
21 21
 	filter := getStackFilter(namespace)
22
-	filter.Add("runtimes", string(swarm.RuntimeContainer))
22
+	filter.Add("runtime", string(swarm.RuntimeContainer))
23 23
 	return filter
24 24
 }
25 25
 
... ...
@@ -85,8 +85,8 @@ func serviceSpecFromGRPC(spec *swarmapi.ServiceSpec) (*types.ServiceSpec, error)
85 85
 		taskTemplate.ContainerSpec = containerSpecFromGRPC(containerConfig)
86 86
 		taskTemplate.Runtime = types.RuntimeContainer
87 87
 	case *swarmapi.TaskSpec_Generic:
88
-		switch t.Generic.Payload.TypeUrl {
89
-		case string(types.RuntimeURLPlugin):
88
+		switch t.Generic.Kind {
89
+		case string(types.RuntimePlugin):
90 90
 			taskTemplate.Runtime = types.RuntimePlugin
91 91
 		default:
92 92
 			return nil, fmt.Errorf("unknown task runtime type: %s", t.Generic.Payload.TypeUrl)
... ...
@@ -165,8 +165,8 @@ func (e *executor) Controller(t *api.Task) (exec.Controller, error) {
165 165
 	switch r := t.Spec.GetRuntime().(type) {
166 166
 	case *api.TaskSpec_Generic:
167 167
 		logrus.WithFields(logrus.Fields{
168
-			"kind":       r.Generic.Kind,
169
-			"runtimeUrl": r.Generic.Payload.TypeUrl,
168
+			"kind":     r.Generic.Kind,
169
+			"type_url": r.Generic.Payload.TypeUrl,
170 170
 		}).Debug("custom runtime requested")
171 171
 		runtimeKind, err := naming.Runtime(t.Spec)
172 172
 		if err != nil {
... ...
@@ -40,11 +40,11 @@ func (c *Cluster) GetServices(options apitypes.ServiceListOptions) ([]types.Serv
40 40
 	// be good to have accepted file check in the same file as
41 41
 	// the filter processing (in the for loop below).
42 42
 	accepted := map[string]bool{
43
-		"name":     true,
44
-		"id":       true,
45
-		"label":    true,
46
-		"mode":     true,
47
-		"runtimes": true,
43
+		"name":    true,
44
+		"id":      true,
45
+		"label":   true,
46
+		"mode":    true,
47
+		"runtime": true,
48 48
 	}
49 49
 	if err := options.Filters.Validate(accepted); err != nil {
50 50
 		return nil, err
... ...
@@ -54,7 +54,7 @@ func (c *Cluster) GetServices(options apitypes.ServiceListOptions) ([]types.Serv
54 54
 		NamePrefixes: options.Filters.Get("name"),
55 55
 		IDPrefixes:   options.Filters.Get("id"),
56 56
 		Labels:       runconfigopts.ConvertKVStringsToMap(options.Filters.Get("label")),
57
-		Runtimes:     options.Filters.Get("runtimes"),
57
+		Runtimes:     options.Filters.Get("runtime"),
58 58
 	}
59 59
 
60 60
 	ctx, cancel := c.getRequestContext()