mirror of
https://github.com/containers/podman.git
synced 2025-07-15 03:02:52 +08:00
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
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user