containerd/supervisor/get_containers.go
Michael Crosby 76d69b4ed8 Add id to state command to return single container
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-02-11 12:20:29 -08:00

20 lines
395 B
Go

package supervisor
type GetContainersEvent struct {
s *Supervisor
}
func (h *GetContainersEvent) Handle(e *Event) error {
if e.ID != "" {
ci := h.s.containers[e.ID]
if ci == nil {
return ErrContainerNotFound
}
e.Containers = append(e.Containers, ci.container)
return nil
}
for _, i := range h.s.containers {
e.Containers = append(e.Containers, i.container)
}
return nil
}