Merge pull request #26551 from cpuguy83/26548_fix_tasks

Do not look at `Attachment` tasks in /tasks
This commit is contained in:
Jana Radhakrishnan 2016-09-13 21:27:15 -07:00 committed by GitHub
commit 3ae023cd22
2 changed files with 6 additions and 1 deletions

View file

@ -1158,7 +1158,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))