Add logging support for base condition in debug

Signed-off-by: Yann Ramin <atrus@stackworks.net>
This commit is contained in:
Yann Ramin 2018-02-06 01:32:23 -06:00
parent a2fc41358a
commit 9a86dbabc2

View file

@ -42,21 +42,25 @@ func (s *Server) filterContainerList(filter *pb.ContainerFilter, origCtrList []*
} }
c := s.ContainerServer.GetContainer(id) c := s.ContainerServer.GetContainer(id)
if c != nil { if c != nil {
if filter.PodSandboxId == "" || c.Sandbox() == filter.PodSandboxId { switch {
case filter.PodSandboxId == "":
return []*oci.Container{c}
case c.Sandbox() == filter.PodSandboxId:
return []*oci.Container{c}
default:
return []*oci.Container{} return []*oci.Container{}
} }
return []*oci.Container{c}
} }
} else { } else {
if filter.PodSandboxId != "" { if filter.PodSandboxId != "" {
pod := s.ContainerServer.GetSandbox(filter.PodSandboxId) pod := s.ContainerServer.GetSandbox(filter.PodSandboxId)
if pod == nil { if pod == nil {
return []*oci.Container{} return []*oci.Container{}
} else { }
return pod.Containers().List() return pod.Containers().List()
} }
} }
} logrus.Debug("no filters were applied, returning full container list")
return origCtrList return origCtrList
} }