aboutsummaryrefslogtreecommitdiff
path: root/libpod/pod_api.go
diff options
context:
space:
mode:
authorSujil02 <sushah@redhat.com>2020-04-20 06:42:51 -0400
committerSujil02 <sushah@redhat.com>2020-04-20 07:05:25 -0400
commit838df56bcf960edb81d7a26250278298d4997e55 (patch)
treefce01860246e6bcff91ce773e3fd39c198956331 /libpod/pod_api.go
parente4e42b28dfef0ffd12f2087048dec61f9cb03976 (diff)
downloadpodman-838df56bcf960edb81d7a26250278298d4997e55.tar.gz
podman-838df56bcf960edb81d7a26250278298d4997e55.tar.bz2
podman-838df56bcf960edb81d7a26250278298d4997e55.zip
Update pod inspect report to hold current pod status.
Added status field in pod inspect report. Fixed pod tests to use it. Signed-off-by: Sujil02 <sushah@redhat.com>
Diffstat (limited to 'libpod/pod_api.go')
-rw-r--r--libpod/pod_api.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/libpod/pod_api.go b/libpod/pod_api.go
index ed4dc0727..45aa5cb8d 100644
--- a/libpod/pod_api.go
+++ b/libpod/pod_api.go
@@ -446,6 +446,7 @@ func (p *Pod) Inspect() (*define.InspectPodData, error) {
if err != nil {
return nil, err
}
+ ctrStatuses := make(map[string]define.ContainerStatus, len(containers))
for _, c := range containers {
containerStatus := "unknown"
// Ignoring possible errors here because we don't want this to be
@@ -459,12 +460,18 @@ func (p *Pod) Inspect() (*define.InspectPodData, error) {
Name: c.Name(),
State: containerStatus,
})
+ ctrStatuses[c.ID()] = c.state.State
+ }
+ podState, err := CreatePodStatusResults(ctrStatuses)
+ if err != nil {
+ return nil, err
}
inspectData := define.InspectPodData{
ID: p.ID(),
Name: p.Name(),
Namespace: p.Namespace(),
Created: p.CreatedTime(),
+ State: podState,
Hostname: "",
Labels: p.Labels(),
CreateCgroup: false,