diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-03-26 20:10:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-26 20:10:08 +0100 |
commit | 913426c70c37a87d425085f60af397f7b38bd65d (patch) | |
tree | 97bee43dab0b8cd1edfa0977b78048d61fc59ed9 /libpod/runtime_ctr.go | |
parent | 14ece7ecaf6e2b7fe65d64ed872fbfe2d740f48b (diff) | |
parent | e42cbdd1b2f6788a814d6aa1838111989cd424ad (diff) | |
download | podman-913426c70c37a87d425085f60af397f7b38bd65d.tar.gz podman-913426c70c37a87d425085f60af397f7b38bd65d.tar.bz2 podman-913426c70c37a87d425085f60af397f7b38bd65d.zip |
Merge pull request #5573 from mheon/add_basic_exec_endpoints
Implement APIv2 Exec Create and Inspect Endpoints
Diffstat (limited to 'libpod/runtime_ctr.go')
-rw-r--r-- | libpod/runtime_ctr.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go index 0b18436ca..b99e6df84 100644 --- a/libpod/runtime_ctr.go +++ b/libpod/runtime_ctr.go @@ -830,6 +830,24 @@ func (r *Runtime) GetLatestContainer() (*Container, error) { return ctrs[lastCreatedIndex], nil } +// GetExecSessionContainer gets the container that a given exec session ID is +// attached to. +func (r *Runtime) GetExecSessionContainer(id string) (*Container, error) { + r.lock.RLock() + defer r.lock.RUnlock() + + if !r.valid { + return nil, define.ErrRuntimeStopped + } + + ctrID, err := r.state.GetExecSession(id) + if err != nil { + return nil, err + } + + return r.state.Container(ctrID) +} + // PruneContainers removes stopped and exited containers from localstorage. A set of optional filters // can be provided to be more granular. func (r *Runtime) PruneContainers(filterFuncs []ContainerFilter) (map[string]int64, map[string]error, error) { |