Browse code

Do not look at `Attachment` tasks in /tasks

Fixes #26548

Signed-off-by: Brian Goff <cpuguy83@gmail.com>

Brian Goff authored on 2016/09/14 09:44:06
Showing 2 changed files
... ...
@@ -1157,7 +1157,9 @@ func (c *Cluster) GetTasks(options apitypes.TaskListOptions) ([]types.Task, erro
1157 1157
 	tasks := []types.Task{}
1158 1158
 
1159 1159
 	for _, task := range r.Tasks {
1160
-		tasks = append(tasks, convert.TaskFromGRPC(*task))
1160
+		if task.Spec.GetContainer() != nil {
1161
+			tasks = append(tasks, convert.TaskFromGRPC(*task))
1162
+		}
1161 1163
 	}
1162 1164
 	return tasks, nil
1163 1165
 }
... ...
@@ -10,6 +10,9 @@ import (
10 10
 
11 11
 // TaskFromGRPC converts a grpc Task to a Task.
12 12
 func TaskFromGRPC(t swarmapi.Task) types.Task {
13
+	if t.Spec.GetAttachment() != nil {
14
+		return types.Task{}
15
+	}
13 16
 	containerConfig := t.Spec.Runtime.(*swarmapi.TaskSpec_Container).Container
14 17
 	containerStatus := t.Status.GetContainer()
15 18
 	networks := make([]types.NetworkAttachmentConfig, 0, len(t.Spec.Networks))