Skip to content

Commit 3ae023c

Browse files
authored
Merge pull request moby#26551 from cpuguy83/26548_fix_tasks
Do not look at `Attachment` tasks in /tasks
2 parents 1d76ab4 + 15eee03 commit 3ae023c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

daemon/cluster/cluster.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -1158,7 +1158,9 @@ func (c *Cluster) GetTasks(options apitypes.TaskListOptions) ([]types.Task, erro
11581158
tasks := []types.Task{}
11591159

11601160
for _, task := range r.Tasks {
1161-
tasks = append(tasks, convert.TaskFromGRPC(*task))
1161+
if task.Spec.GetContainer() != nil {
1162+
tasks = append(tasks, convert.TaskFromGRPC(*task))
1163+
}
11621164
}
11631165
return tasks, nil
11641166
}

daemon/cluster/convert/task.go

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import (
1010

1111
// TaskFromGRPC converts a grpc Task to a Task.
1212
func TaskFromGRPC(t swarmapi.Task) types.Task {
13+
if t.Spec.GetAttachment() != nil {
14+
return types.Task{}
15+
}
1316
containerConfig := t.Spec.Runtime.(*swarmapi.TaskSpec_Container).Container
1417
containerStatus := t.Status.GetContainer()
1518
networks := make([]types.NetworkAttachmentConfig, 0, len(t.Spec.Networks))

0 commit comments

Comments
 (0)