f15859c79f
Some runtimes like Clear Containers need to interpret the CRI-O annotations, to distinguish the infra container from the regular one. Here we export those annotations and use a more standard dotted namespace for them. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
24 lines
544 B
Go
24 lines
544 B
Go
package server
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/kubernetes-incubator/cri-o/oci"
|
|
)
|
|
|
|
func (s *Server) getContainerFromRequest(cid string) (*oci.Container, error) {
|
|
if cid == "" {
|
|
return nil, fmt.Errorf("container ID should not be empty")
|
|
}
|
|
|
|
containerID, err := s.ctrIDIndex.Get(cid)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("container with ID starting with %s not found: %v", cid, err)
|
|
}
|
|
|
|
c := s.state.containers.Get(containerID)
|
|
if c == nil {
|
|
return nil, fmt.Errorf("specified container not found: %s", containerID)
|
|
}
|
|
return c, nil
|
|
}
|