Browse Source

Merge pull request #26551 from cpuguy83/26548_fix_tasks

Do not look at `Attachment` tasks in /tasks
Jana Radhakrishnan 8 years ago
parent
commit
3ae023cd22
2 changed files with 6 additions and 1 deletions
  1. 3 1
      daemon/cluster/cluster.go
  2. 3 0
      daemon/cluster/convert/task.go

+ 3 - 1
daemon/cluster/cluster.go

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

+ 3 - 0
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))