Do not look at Attachment tasks in /tasks
Fixes #26548 Signed-off-by: Brian Goff <cpuguy83@gmail.com> Upstream-commit: 15eee038c0b06b4f0ae1bf12bebbb9a1f5deec78 Component: engine
This commit is contained in:
@ -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
|
||||
}
|
||||
|
||||
@ -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))
|
||||
|
||||
Reference in New Issue
Block a user