summaryrefslogtreecommitdiff
path: root/libpod/pod_api.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-08-11 11:19:08 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-08-11 18:13:06 +0000
commit3ef9279cec43ca7e24fb00eb838d85e30b7e37f7 (patch)
tree989f39dc6a0a4330e0bb52e8797cb04630c6187c /libpod/pod_api.go
parent029d5aad56e00059d0c765172c15b0035bedcd06 (diff)
downloadpodman-3ef9279cec43ca7e24fb00eb838d85e30b7e37f7.tar.gz
podman-3ef9279cec43ca7e24fb00eb838d85e30b7e37f7.tar.bz2
podman-3ef9279cec43ca7e24fb00eb838d85e30b7e37f7.zip
Ensure pod inspect is locked and validity-checked
Also, don't return the internal podState struct - instead return a public inspect struct. Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #1258 Approved by: rhatdan
Diffstat (limited to 'libpod/pod_api.go')
-rw-r--r--libpod/pod_api.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/libpod/pod_api.go b/libpod/pod_api.go
index 82c19e2b5..82cf7b727 100644
--- a/libpod/pod_api.go
+++ b/libpod/pod_api.go
@@ -398,7 +398,13 @@ func (p *Pod) Inspect() (*PodInspect, error) {
podContainers []PodContainerInfo
)
- containers, err := p.AllContainers()
+ p.lock.Lock()
+ defer p.lock.Unlock()
+ if err := p.updatePod(); err != nil {
+ return nil, err
+ }
+
+ containers, err := p.runtime.state.PodContainers(p)
if err != nil {
return &PodInspect{}, err
}
@@ -420,8 +426,10 @@ func (p *Pod) Inspect() (*PodInspect, error) {
config := new(PodConfig)
deepcopier.Copy(p.config).To(config)
inspectData := PodInspect{
- Config: config,
- State: p.state,
+ Config: config,
+ State: &PodInspectState{
+ CgroupPath: p.state.CgroupPath,
+ },
Containers: podContainers,
}
return &inspectData, nil