2015-12-18 00:07:04 +00:00
|
|
|
package supervisor
|
2015-12-01 18:55:13 +00:00
|
|
|
|
2016-02-17 18:55:54 +00:00
|
|
|
import "github.com/docker/containerd/runtime"
|
|
|
|
|
2016-02-12 01:26:24 +00:00
|
|
|
type GetContainersTask struct {
|
2016-02-17 18:55:54 +00:00
|
|
|
baseTask
|
|
|
|
ID string
|
|
|
|
Containers []runtime.Container
|
2015-12-01 18:55:13 +00:00
|
|
|
}
|
|
|
|
|
2016-02-17 18:55:54 +00:00
|
|
|
func (s *Supervisor) getContainers(t *GetContainersTask) error {
|
|
|
|
if t.ID != "" {
|
|
|
|
ci := s.containers[t.ID]
|
2016-02-11 20:20:29 +00:00
|
|
|
if ci == nil {
|
|
|
|
return ErrContainerNotFound
|
|
|
|
}
|
2016-02-17 18:55:54 +00:00
|
|
|
t.Containers = append(t.Containers, ci.container)
|
2016-02-11 20:20:29 +00:00
|
|
|
return nil
|
|
|
|
}
|
2016-02-17 18:55:54 +00:00
|
|
|
for _, i := range s.containers {
|
|
|
|
t.Containers = append(t.Containers, i.container)
|
2015-12-01 18:55:13 +00:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|