diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-05-02 20:45:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-02 20:45:44 +0200 |
commit | ccf28a89bdded86b044f2fd3aa3389b923a81988 (patch) | |
tree | 2acc41efb2ade3f451004a2d00c702eaeba53cad /libpod/container_internal.go | |
parent | 3cec403268cf311ed21d981089236cabd0bd66f7 (diff) | |
parent | 4b339145356e505971aa04773ef733c2938687ff (diff) | |
download | podman-ccf28a89bdded86b044f2fd3aa3389b923a81988.tar.gz podman-ccf28a89bdded86b044f2fd3aa3389b923a81988.tar.bz2 podman-ccf28a89bdded86b044f2fd3aa3389b923a81988.zip |
Merge pull request #3039 from mheon/podman_init
Add podman init command
Diffstat (limited to 'libpod/container_internal.go')
-rw-r--r-- | libpod/container_internal.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go index 7febf6966..a791df491 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -811,8 +811,9 @@ func (c *Container) cleanupRuntime(ctx context.Context) error { span.SetTag("struct", "container") defer span.Finish() - // If the container is not ContainerStateStopped, do nothing - if c.state.State != ContainerStateStopped { + // If the container is not ContainerStateStopped or + // ContainerStateCreated, do nothing. + if c.state.State != ContainerStateStopped && c.state.State != ContainerStateCreated { return nil } @@ -825,9 +826,14 @@ func (c *Container) cleanupRuntime(ctx context.Context) error { return err } - // Our state is now Exited, as we've removed ourself from - // the runtime. - c.state.State = ContainerStateExited + // If we were Stopped, we are now Exited, as we've removed ourself + // from the runtime. + // If we were Created, we are now Configured. + if c.state.State == ContainerStateStopped { + c.state.State = ContainerStateExited + } else if c.state.State == ContainerStateCreated { + c.state.State = ContainerStateConfigured + } if c.valid { if err := c.save(); err != nil { |