Do not look at Attachment tasks in /tasks

Fixes #26548

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
Brian Goff 2016-09-13 20:44:06 -04:00
parent 85c3b8c1b1
commit 15eee038c0
2 changed files with 6 additions and 1 deletions

View file

@ -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
}

View file

@ -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))