mirror of https://github.com/containers/podman.git
Merge pull request #26149 from azdle/docker-api-container-status
compat: fix ContainerState.Status JSON values
This commit is contained in:
commit
5629ba8a8d
|
|
@ -236,7 +236,7 @@ It’s important to describe the change in plain English for the reviewer to ver
|
|||
Solve only one problem per patch.
|
||||
If your description starts to get long, that’s a sign that you probably need to split up your patch.
|
||||
|
||||
If the patch fixes a logged bug entry, refer to that bug entry by number and URL.
|
||||
If the patch fixes a logged bug entry, refer to that bug entry by number or URL.
|
||||
If the patch follows from a mailing list discussion, give a URL to the mailing list archive.
|
||||
Please format these lines as `Fixes:` followed by the URL or, for Github bugs, the bug number preceded by a #.
|
||||
For example:
|
||||
|
|
|
|||
|
|
@ -463,9 +463,20 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*container.InspectResp
|
|||
state.Running = true
|
||||
}
|
||||
|
||||
// Dockers created state is our configured state
|
||||
if state.Status == define.ContainerStateCreated.String() {
|
||||
state.Status = define.ContainerStateConfigured.String()
|
||||
// map our statuses to Docker's statuses
|
||||
switch state.Status {
|
||||
case define.ContainerStateConfigured.String(), define.ContainerStateCreated.String():
|
||||
state.Status = "created"
|
||||
case define.ContainerStateRunning.String(), define.ContainerStateStopping.String():
|
||||
state.Status = "running"
|
||||
case define.ContainerStatePaused.String():
|
||||
state.Status = "paused"
|
||||
case define.ContainerStateRemoving.String():
|
||||
state.Status = "removing"
|
||||
case define.ContainerStateStopped.String(), define.ContainerStateExited.String():
|
||||
state.Status = "exited"
|
||||
default:
|
||||
state.Status = "" // unknown state
|
||||
}
|
||||
|
||||
if l.HasHealthCheck() && state.Status != "created" {
|
||||
|
|
|
|||
|
|
@ -698,7 +698,7 @@ t GET containers/status-test/json 200 .State.Status="running"
|
|||
|
||||
podman stop status-test &
|
||||
sleep 1
|
||||
t GET containers/status-test/json 200 .State.Status="stopping"
|
||||
t GET containers/status-test/json 200 .State.Status="running"
|
||||
|
||||
sleep 3
|
||||
t GET containers/status-test/json 200 .State.Status="exited"
|
||||
|
|
|
|||
Loading…
Reference in New Issue