From 15eee038c0b06b4f0ae1bf12bebbb9a1f5deec78 Mon Sep 17 00:00:00 2001 From: Brian Goff Date: Tue, 13 Sep 2016 20:44:06 -0400 Subject: [PATCH] Do not look at `Attachment` tasks in /tasks Fixes #26548 Signed-off-by: Brian Goff --- daemon/cluster/cluster.go | 4 +++- daemon/cluster/convert/task.go | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/daemon/cluster/cluster.go b/daemon/cluster/cluster.go index 8106115837..f19e5e5a27 100644 --- a/daemon/cluster/cluster.go +++ b/daemon/cluster/cluster.go @@ -1157,7 +1157,9 @@ func (c *Cluster) GetTasks(options apitypes.TaskListOptions) ([]types.Task, erro tasks := []types.Task{} for _, task := range r.Tasks { - tasks = append(tasks, convert.TaskFromGRPC(*task)) + if task.Spec.GetContainer() != nil { + tasks = append(tasks, convert.TaskFromGRPC(*task)) + } } return tasks, nil } diff --git a/daemon/cluster/convert/task.go b/daemon/cluster/convert/task.go index 2d60458ac9..e3be8b8eaf 100644 --- a/daemon/cluster/convert/task.go +++ b/daemon/cluster/convert/task.go @@ -10,6 +10,9 @@ import ( // TaskFromGRPC converts a grpc Task to a Task. func TaskFromGRPC(t swarmapi.Task) types.Task { + if t.Spec.GetAttachment() != nil { + return types.Task{} + } containerConfig := t.Spec.Runtime.(*swarmapi.TaskSpec_Container).Container containerStatus := t.Status.GetContainer() networks := make([]types.NetworkAttachmentConfig, 0, len(t.Spec.Networks))