Exec prepares a streaming endpoint to execute a command in the container, and returns the address.
(ctx context.Context, r *runtime.ExecRequest)
| 26 | |
| 27 | // Exec prepares a streaming endpoint to execute a command in the container, and returns the address. |
| 28 | func (c *criService) Exec(ctx context.Context, r *runtime.ExecRequest) (*runtime.ExecResponse, error) { |
| 29 | span := tracing.SpanFromContext(ctx) |
| 30 | cntr, err := c.containerStore.Get(r.GetContainerId()) |
| 31 | if err != nil { |
| 32 | return nil, fmt.Errorf("failed to find container %q in store: %w", r.GetContainerId(), err) |
| 33 | } |
| 34 | span.SetAttributes(tracing.Attribute("container.id", cntr.ID)) |
| 35 | state := cntr.Status.Get().State() |
| 36 | if state != runtime.ContainerState_CONTAINER_RUNNING { |
| 37 | return nil, fmt.Errorf("container is in %s state", criContainerStateToString(state)) |
| 38 | } |
| 39 | return c.streamServer.GetExec(r) |
| 40 | } |
nothing calls this directly
no test coverage detected