diff options
author | Matthew Heon <matthew.heon@pm.me> | 2020-03-20 15:23:35 -0400 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2020-03-23 16:20:42 -0400 |
commit | 0c40b62c77d8f7dba8e73ac3ced0de536ec220d5 (patch) | |
tree | 3c87c6bb63dbc0970602c44dfa5d1c99f7156681 /libpod/runtime_ctr.go | |
parent | 3e835a8025bfc4a7a2790f1d343c6ea246fc65ee (diff) | |
download | podman-0c40b62c77d8f7dba8e73ac3ced0de536ec220d5.tar.gz podman-0c40b62c77d8f7dba8e73ac3ced0de536ec220d5.tar.bz2 podman-0c40b62c77d8f7dba8e73ac3ced0de536ec220d5.zip |
Implement APIv2 Exec Create and Inspect Endpoints
Start and Resize require further implementation work.
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
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) { |